Open Moosems opened 1 year ago
Actually, they're slightly different. #4 is about REPLs and how you can't give input whereas this is about if you run a command that takes a long time, the app freezes.
Okay. I just mean the app freezes just like #4
Actually, they're slightly different. #4 is about REPLs and how you can't give input whereas this is about if you run a command that takes a long time, the app freezes.
Tkinter marks the window as not responding if the app does not respond for 5 seconds. Since the app currently freezes its process till the command finishes executing, if the command lasts 5+ secs the app freezes.
Correct, but running any tkinter apps from the terminal will cause issues (an example).
So, is there any way to solve this problem?
Thats a great question. My current idea is this:
Right now, the way the terminal works is to run the command on <Return>
. The running of this command takes place in an event which must complete before anything else can happen. To fix this, we could possibly do the following:
Control-c
This could theoretically prevent the app from crashing, open to new ideas though.
Thats a great question. My current idea is this:
Right now, the way the terminal works is to run the command on
<Return>
. The running of this command takes place in an event which must complete before anything else can happen. To fix this, we could possibly do the following:
- On return, the cmd is created along with the subprocess which is saved into a variable
- The Popen stdout is put into a temporary file (in the cache dir) and is allowed to keep writing there as it goes
- The Popen is then started but we allow the after to end while doing two things: 1. while the subprocess is not completed we check the file every 50 ms or so and check if it spits out anything to be put into the console 2: we allow input during this time to be pushed to the subprocess 3. we set an after to run once the process is complete that will put in the directory and whatnot
- I might add that in this type the user can also cancel the subprocess with
Control-c
This could theoretically prevent the app from crashing, open to new ideas though.
wow, great!
When I run a Python file that uses tkinter, re-focusing the app shows that its confused as there is the rotating wheel of death.