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?
Python in background
First unread post • 9 posts
• Page 1 of 1
-
mickenx
Niveau 2: MI2 (Membre Initié)- Posts: 5
- Joined: 14 Sep 2024, 09:30
- Gender:
- Calculator(s):→ MyCalcs profile
Re: Python in background
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?
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
-
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)- Posts: 14722
- Images: 1119
- Joined: 01 Jun 2007, 00:00
- Location: France
- Gender:
- Calculator(s):→ MyCalcs profile
- Twitter: adriweb
- GitHub: adriweb
Re: Python in background
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
-
mickenx
Niveau 2: MI2 (Membre Initié)- Posts: 5
- Joined: 14 Sep 2024, 09:30
- Gender:
- Calculator(s):→ MyCalcs profile
Re: Python in background
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.
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
-
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)- Posts: 14722
- Images: 1119
- Joined: 01 Jun 2007, 00:00
- Location: France
- Gender:
- Calculator(s):→ MyCalcs profile
- Twitter: adriweb
- GitHub: adriweb
Re: Python in background
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.
-
mickenx
Niveau 2: MI2 (Membre Initié)- Posts: 5
- Joined: 14 Sep 2024, 09:30
- Gender:
- Calculator(s):→ MyCalcs profile
Re: Python in background
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
-
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)- Posts: 14722
- Images: 1119
- Joined: 01 Jun 2007, 00:00
- Location: France
- Gender:
- Calculator(s):→ MyCalcs profile
- Twitter: adriweb
- GitHub: adriweb
Re: Python in background
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.
-
mickenx
Niveau 2: MI2 (Membre Initié)- Posts: 5
- Joined: 14 Sep 2024, 09:30
- Gender:
- Calculator(s):→ MyCalcs profile
Re: Python in background
Ok yeah, then I guess there isn't much more we can do here, at least one of the languages can run "in background"
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
-
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)- Posts: 14722
- Images: 1119
- Joined: 01 Jun 2007, 00:00
- Location: France
- Gender:
- Calculator(s):→ MyCalcs profile
- Twitter: adriweb
- GitHub: adriweb
Re: Python in background
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.
-
mickenx
Niveau 2: MI2 (Membre Initié)- Posts: 5
- Joined: 14 Sep 2024, 09:30
- Gender:
- Calculator(s):→ MyCalcs profile
9 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest