π
<-

Python in background

TI's micropython + modules

Python in background

Message non lude 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?
Avatar de l’utilisateur
mickenx
Niveau 2: MI2 (Membre Initié)
Niveau 2: MI2 (Membre Initié)
Prochain niv.: 26.7%
 
Messages: 5
Inscription: 14 Sep 2024, 09:30
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile

Re: Python in background

Message non lude 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
Avatar de l’utilisateur
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Prochain niv.: 80%
 
Messages: 14845
Images: 1133
Inscription: 01 Juin 2007, 00:00
Localisation: France
Genre: Homme
Calculatrice(s):
MyCalcs profile
Twitter/X: adriweb
GitHub: adriweb

Re: Python in background

Message non lude mickenx » 14 Sep 2024, 12:01

Adriweb a écrit: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.
Vous n’avez pas les permissions nécessaires pour voir les fichiers joints à ce message.
Avatar de l’utilisateur
mickenx
Niveau 2: MI2 (Membre Initié)
Niveau 2: MI2 (Membre Initié)
Prochain niv.: 26.7%
 
Messages: 5
Inscription: 14 Sep 2024, 09:30
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile

Re: Python in background

Message non lude 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
Avatar de l’utilisateur
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Prochain niv.: 80%
 
Messages: 14845
Images: 1133
Inscription: 01 Juin 2007, 00:00
Localisation: France
Genre: Homme
Calculatrice(s):
MyCalcs profile
Twitter/X: adriweb
GitHub: adriweb

Re: Python in background

Message non lude 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.
Avatar de l’utilisateur
mickenx
Niveau 2: MI2 (Membre Initié)
Niveau 2: MI2 (Membre Initié)
Prochain niv.: 26.7%
 
Messages: 5
Inscription: 14 Sep 2024, 09:30
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile

Re: Python in background

Message non lude 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
Avatar de l’utilisateur
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Prochain niv.: 80%
 
Messages: 14845
Images: 1133
Inscription: 01 Juin 2007, 00:00
Localisation: France
Genre: Homme
Calculatrice(s):
MyCalcs profile
Twitter/X: adriweb
GitHub: adriweb

Re: Python in background

Message non lude mickenx » 14 Sep 2024, 19:37

Adriweb a écrit: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.
Avatar de l’utilisateur
mickenx
Niveau 2: MI2 (Membre Initié)
Niveau 2: MI2 (Membre Initié)
Prochain niv.: 26.7%
 
Messages: 5
Inscription: 14 Sep 2024, 09:30
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile

Re: Python in background

Message non lude 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
Avatar de l’utilisateur
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Prochain niv.: 80%
 
Messages: 14845
Images: 1133
Inscription: 01 Juin 2007, 00:00
Localisation: France
Genre: Homme
Calculatrice(s):
MyCalcs profile
Twitter/X: adriweb
GitHub: adriweb

Re: Python in background

Message non lude mickenx » 14 Sep 2024, 19:47

dual.jpg
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.
Vous n’avez pas les permissions nécessaires pour voir les fichiers joints à ce message.
Avatar de l’utilisateur
mickenx
Niveau 2: MI2 (Membre Initié)
Niveau 2: MI2 (Membre Initié)
Prochain niv.: 26.7%
 
Messages: 5
Inscription: 14 Sep 2024, 09:30
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile


Retourner vers Python

Qui est en ligne

Utilisateurs parcourant ce forum: ClaudeBot [spider] et 0 invités

-
Rechercher
-
Social TI-Planet
-
Sujets à la une
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.
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
1234
-
Faire un don / Premium
Pour plus de concours, de lots, de tests, nous aider à payer le serveur et les domaines...
Faire un don
Découvrez les avantages d'un compte donateur !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partenaires et pub
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
2116 utilisateurs:
>2086 invités
>23 membres
>7 robots
Record simultané (sur 6 mois):
29271 utilisateurs (le 11/07/2025)
-
Autres sites intéressants
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)