Problem with tkinter & spawning processes
Fredrik Lundh
effbot at telia.com
Tue Mar 14 11:02:56 EST 2000
nathan <nnever50 at yahoo.com> wrote:
> I've programmed a GUI with Tkinter and I've started it with the
> mainloop() as usual. Now, I want to start a new process from
> the GUI, by pressing a button.
>
> I've tried with:
> os.system('"C:\Program Files\Python\Python.exe" -i test.py')
>
> The new process starts fine (standard output on the DOS cmmand
> prompt) nd I cannot do anything more.
>
> It seems that the new started process blocks the mainloop() thread
the os.system call doesn't return until the new process
has terminated.
> How can avoid this?
this might work:
os.system('start "C:\Program Files\Python\Python.exe" -i test.py')
or you could use os.spawn(os.P_NOWAIT, ...). see
http://www.deja.com/=dnc/getdoc.xp?AN=589728736
(tweaking that script to support a wait/nowait flag is
left as an exercise for the reader)
</F>
<!-- (the eff-bot guide to) the standard python library:
http://www.pythonware.com/people/fredrik/librarybook.htm
-->
More information about the Python-list
mailing list