I have a python script and I imported another script (a simple GUI window) using:
import gui
So when I run the code, the GUI pops up and I need to close the GUI in order for the script to continue executing.
Is there any way to run the entire script while keeping the GUI window open the whole time?
You might be able to do this with threading in which the GUI is running off a child thread while the rest of the script runs on the main thread.
Related
I wrote a program to start and stop an AutoHotKey script in the tkinter GUI for my non-coding coworkers to use but the autohotkey script has to be able to send commands through the python shell and I just realized that while the tkinter window is open, I am unable to send commands through the shell. I know theres an AutoHotKey library for Python but I really don't want to have to rewrite too much if possible. Is there anyway to keep the tkinter window up and running while also calling other functions from the shell?
I don't know what to try other than rewriting the whole thing using the AHK library.
I have a python script ('script #1') that runs in a Windows CMD window all day long. The script runs a pynput keyboard listener, and I use this to execute a defined function in the script via a hotkey.
Can I use this same script to add/listen for a hotkey and then launch a different virtual environment and execute a separate python file ('script #2')? Any pointers on how this could be implemented?
Or should I instead add a keyboard listener to script #2 and then dump everything except the import statements of script #2 inside a def functionName block, and then run this second listener script in a separate CMD window? Seems kind of inefficient to do this way, especially as I'd ideally like to have a number of python scripts execute via hotkey.
In my code I would like to launch a function/script in another python window (say, when you run one script, a back window pops up, I want that script to manage other scripts. They don't need to communicate).
Similar to multiprocessing but they have their own pop up windows and outputs. All their information is going to be written to a file there after.
I have searched a fair amount but it seems like no one want a script to run another script in another window, potentially running 4 or 5 python windows consecutively, each using a separate core.
You should be able to use os.startfile(filename) Here is an example that runs another python file:
import os
os.startfile("File.py")
print("Started Running!")
This will open and run another python program, allowing this program to continue running.
Basically, I need to run a script that tells a running process (python script) to do something.
I have a pyside UI with a listview that i need to update. This is executed as a subprocess of a program (Vicon Blade).
Now I need to update the listview by running a second python script from the same program.
How do I do that? I have looked into signal, subprocess and other modules, but i can't find a proper solution, where the UI stays responsive or doesn't close.
Thanks,
I need to create a python script that monitors another python script, specifically, some variables from it. I was thinking of creating an independent thread in the "observer script" that does this. This thread must run until the "executer script" finishes. Maybe all of this can be done inside one big script (observer+executer), I really do not know at the moment.
Is it possible at all to do this with python in windows?