Python spawn subprocess in background1/12/2024 In the entry point of your script create an instance of "MyWindow", show it and start the Gtk main loop.īefore that, read the documentation of Gtk and look for a class that wraps background processes, like "QProcess" does in Qt. Create an instance of this class in In "MyWindow._init_()" (where "MyWindow" is derived from "Gtk.Window") and connect the "BackgroundWorker.finished" signal to a callback which closes the window. Wrap the invocation of the background task in a separate class – let's call it "BackgroundWorker" for now – that spawns a background thread which in turn executes the process via "subprocess.call()" and emits a "finished" signal when the process terminated. Use "subprocess.Popen" to spawn processes. "os.popen" and related functions have been superseded by the "subprocess" module.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |