π
<-
Chat plein-écran
[^]

Python in background

TI's micropython + modules

Python in background

Unread postby mickenx » 14 Sep 2024, 09:33

Hello.

I have tried to run a python script that runs in backround and pokes a LUA script. It works in the emulator but not on calculator. The python scripts pokes LUA , but I can't change page when it is running,

Is this possible?
User avatar
mickenx
Niveau 2: MI2 (Membre Initié)
Niveau 2: MI2 (Membre Initié)
Level up: 26.7%
 
Posts: 5
Joined: 14 Sep 2024, 09:30
Gender: Not specified
Calculator(s):
MyCalcs profile

Re: Python in background

Unread postby Adriweb » 14 Sep 2024, 11:05

Hi,

What do you mean exactly by "The python scripts pokes LUA" ?
As far as I know, this is only kind of doable indirectly by changing some variables that the lua script monitors.

Can you share your .tns file?

MyCalcs: Help the community's calculator documentations by filling out your calculators info!
MyCalcs: Aidez la communauté à documenter les calculatrices en donnant des infos sur vos calculatrices !
Inspired-Lua.org: All about TI-Nspire Lua programming (tutorials, wiki/docs...)
My calculator programs
Mes programmes pour calculatrices
User avatar
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Level up: 78.8%
 
Posts: 14722
Images: 1119
Joined: 01 Jun 2007, 00:00
Location: France
Gender: Male
Calculator(s):
MyCalcs profile
Twitter: adriweb
GitHub: adriweb

Re: Python in background

Unread postby mickenx » 14 Sep 2024, 12:01

Adriweb wrote:Hi,

What do you mean exactly by "The python scripts pokes LUA" ?
As far as I know, this is only kind of doable indirectly by changing some variables that the lua script monitors.

Can you share your .tns file?


I am using change of variables. I followed a example , it might be yours. EDIT: yes it was you:
https://www.cemetech.net/forum/viewtopi ... 06&start=0

The script is running to set variables that animates the graph. Python makes the change happen. I wanted to inject functions but python doesn't like to change variables with strings.

It works just fine on emulator. But on the calculator I can see from the printouts that the on.varChange is working. However I can't change page. The device is singletasking. The tns is kind of mess. but attaching it anyway.
Attachments
3dsB.tns
(5.64 KiB) Downloaded 9 times
User avatar
mickenx
Niveau 2: MI2 (Membre Initié)
Niveau 2: MI2 (Membre Initié)
Level up: 26.7%
 
Posts: 5
Joined: 14 Sep 2024, 09:30
Gender: Not specified
Calculator(s):
MyCalcs profile

Re: Python in background

Unread postby Adriweb » 14 Sep 2024, 12:50

Ok I see.
The simulator refreshes (invalidates, rather) the lua stuff much more often than on the calculator (which only does it when needed, to save power), so this is actually expected.

You could try forcing a platform.window:invalidate() inside an on.timer() (don't forget to start the timer first) if you want continuous background update, but check what happens if you do that only inside on.varChange first.

But also yeah, it's not true multitasking, just some event loops.
Try also splitting the screen python/lua in a single tab, to see how it reacts without having to change tabs.

MyCalcs: Help the community's calculator documentations by filling out your calculators info!
MyCalcs: Aidez la communauté à documenter les calculatrices en donnant des infos sur vos calculatrices !
Inspired-Lua.org: All about TI-Nspire Lua programming (tutorials, wiki/docs...)
My calculator programs
Mes programmes pour calculatrices
User avatar
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Level up: 78.8%
 
Posts: 14722
Images: 1119
Joined: 01 Jun 2007, 00:00
Location: France
Gender: Male
Calculator(s):
MyCalcs profile
Twitter: adriweb
GitHub: adriweb

Re: Python in background

Unread postby mickenx » 14 Sep 2024, 19:18

I had timer initially, but wanted to see if I could do it another way.. I got the CX II some days ago, and it is a decent update to my old CX. I also bought a micro:bit, because of fun.
User avatar
mickenx
Niveau 2: MI2 (Membre Initié)
Niveau 2: MI2 (Membre Initié)
Level up: 26.7%
 
Posts: 5
Joined: 14 Sep 2024, 09:30
Gender: Not specified
Calculator(s):
MyCalcs profile

Re: Python in background

Unread postby Adriweb » 14 Sep 2024, 19:24

well sure - I'm wondering if on.varChange gets called while a python script is still running, I guess (in which case you can do the "platform.window:invalidate()" inside there)

MyCalcs: Help the community's calculator documentations by filling out your calculators info!
MyCalcs: Aidez la communauté à documenter les calculatrices en donnant des infos sur vos calculatrices !
Inspired-Lua.org: All about TI-Nspire Lua programming (tutorials, wiki/docs...)
My calculator programs
Mes programmes pour calculatrices
User avatar
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Level up: 78.8%
 
Posts: 14722
Images: 1119
Joined: 01 Jun 2007, 00:00
Location: France
Gender: Male
Calculator(s):
MyCalcs profile
Twitter: adriweb
GitHub: adriweb

Re: Python in background

Unread postby mickenx » 14 Sep 2024, 19:37

Adriweb wrote:well sure - I'm wondering if on.varChange gets called while a python script is still running, I guess (in which case you can do the "platform.window:invalidate()" inside there)

It is called. I print out the variables for the graph in python and they are modified because of the varChange thing. It is interesting to have LUA going as a background. I just wish that I could navigate with python running.
User avatar
mickenx
Niveau 2: MI2 (Membre Initié)
Niveau 2: MI2 (Membre Initié)
Level up: 26.7%
 
Posts: 5
Joined: 14 Sep 2024, 09:30
Gender: Not specified
Calculator(s):
MyCalcs profile

Re: Python in background

Unread postby Adriweb » 14 Sep 2024, 19:43

Ok yeah, then I guess there isn't much more we can do here, at least one of the languages can run "in background" :P

MyCalcs: Help the community's calculator documentations by filling out your calculators info!
MyCalcs: Aidez la communauté à documenter les calculatrices en donnant des infos sur vos calculatrices !
Inspired-Lua.org: All about TI-Nspire Lua programming (tutorials, wiki/docs...)
My calculator programs
Mes programmes pour calculatrices
User avatar
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Level up: 78.8%
 
Posts: 14722
Images: 1119
Joined: 01 Jun 2007, 00:00
Location: France
Gender: Male
Calculator(s):
MyCalcs profile
Twitter: adriweb
GitHub: adriweb

Re: Python in background

Unread postby mickenx » 14 Sep 2024, 19:47

dual.jpg
dual.jpg (22.43 KiB) Viewed 370 times
If the shell was shared with the graph graph is animated, but navigation still doesn't work.
Would be awesome if I could inject functions from python. I played with doing it from basic functions,that I called from Python , but unfortunately I can't set global variables in functions.
User avatar
mickenx
Niveau 2: MI2 (Membre Initié)
Niveau 2: MI2 (Membre Initié)
Level up: 26.7%
 
Posts: 5
Joined: 14 Sep 2024, 09:30
Gender: Not specified
Calculator(s):
MyCalcs profile


Return to Python

Who is online

Users browsing this forum: No registered users and 1 guest

-
Search
-
Social TI-Planet
-
Featured topics
Comparaisons des meilleurs prix pour acheter sa calculatrice !
"1 calculatrice pour tous", le programme solidaire de Texas Instruments. Reçois gratuitement et sans aucune obligation d'achat, 5 calculatrices couleur programmables en Python à donner aux élèves les plus nécessiteux de ton lycée. Tu peux recevoir au choix 5 TI-82 Advanced Edition Python ou bien 5 TI-83 Premium CE Edition Python.
Enseignant(e), reçois gratuitement 1 exemplaire de test de la TI-82 Advanced Edition Python. À demander d'ici le 31 décembre 2024.
Reprise de ton ancienne fx-92 Collège ou Graph 25/35/90 à 3€ peu importe son état. Même non fonctionnelle et donc invendable, même ancienne Graph 35 non conforme aux programmes (pas de Python), même ancienne Graph 25/35 inutilisable aux examens (pas de mode examen) et donc invendable. Etiquette de retour fournie, pas de frais de port à payer.
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
12345
-
Donations / Premium
For more contests, prizes, reviews, helping us pay the server and domains...
Donate
Discover the the advantages of a donor account !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partner and ad
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
1040 utilisateurs:
>1019 invités
>11 membres
>10 robots
Record simultané (sur 6 mois):
6892 utilisateurs (le 07/06/2017)
-
Other interesting websites
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)