Problem with tkinter & spawning processes

Fredrik Lundh effbot at
Tue Mar 14 17:02:56 CET 2000

nathan <nnever50 at> 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')
> 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')

or you could use os.spawn(os.P_NOWAIT, ...).  see

(tweaking that script to support a wait/nowait flag is
left as an exercise for the reader)


<!-- (the eff-bot guide to) the standard python library:

More information about the Python-list mailing list