1210
Comment:
|
← Revision 7 as of 2008-11-15 14:00:04 ⇥
1216
converted to 1.6 markup
|
Deletions are marked like this. | Additions are marked like this. |
Line 2: | Line 2: |
[http://groups.google.com/group/comp.lang.python/msg/7edd2c4b0c7fe185 this Usenet posting]. No single answer is canonical, for each has definite liabilities and limitations; there are, however, a number of expedients which apply in at least some situations: * "fire and forget", that is, put the [http://docs.python.org/lib/module-subprocess.html subprocess] in the background and let it run freely; |
[[http://groups.google.com/group/comp.lang.python/msg/7edd2c4b0c7fe185|this Usenet posting]]. No single answer is canonical, for each has definite liabilities and limitations; there are, however, a number of expedients which apply in at least some situations: * "fire and forget", that is, put the [[http://docs.python.org/lib/module-subprocess.html|subprocess]] in the background and let it run freely; |
Line 7: | Line 7: |
* the particular GUI framework involved--wxPython, TkInter, probably has specific mechanisms for managing concurrency in an event-based way. The toolkit behind Tkinter, in fact, already has a Wiki page on [http://wiki.tcl.tk/1526 the subject above], many of whose hints can be adapted to other frameworks; | * the particular GUI framework involved--wxPython, TkInter, probably has specific mechanisms for managing concurrency in an event-based way. The toolkit behind Tkinter, in fact, already has a Wiki page on [[http://wiki.tcl.tk/1526|the subject above]], many of whose hints can be adapted to other frameworks; |
This frequently-asked question appears, for example, in this Usenet posting. No single answer is canonical, for each has definite liabilities and limitations; there are, however, a number of expedients which apply in at least some situations:
"fire and forget", that is, put the subprocess in the background and let it run freely;
- put the subprocess in the background, return to the GUI's event loop, and poll to detect when the subprocess has terminated;
put the subprocess in its own thread, and rely on Python ThreadProgramming ...;
launch subprocess.Popen() in a conventional way, but interleave attention in a single thread of control between the GUI controller and the stdout from the subprocess.
the particular GUI framework involved--wxPython, TkInter, probably has specific mechanisms for managing concurrency in an event-based way. The toolkit behind Tkinter, in fact, already has a Wiki page on the subject above, many of whose hints can be adapted to other frameworks;
- ...
[links, explanations, warnings]