Problem with tkinter & spawning processes

nathan nnever50 at yahoo.com
Wed Mar 15 04:31:35 EST 2000


hello
I've tried with

os.system('start "C:\Program Files\Python\Python.exe" -i test.py')

and the new process starts fine. But if I try to get back to the GUI the
test.py process is killed.
Then I've tried with the program that you gave me with the link
Till the following lines it runs
...
try:
    spawnv = os.spawnv
..
but nothing happens :-/

My problem is that the new process that I start from the GUI, must run while
I 'work' on the GUI.
..
thank you anyway..

Fredrik Lundh <effbot at telia.com> wrote in message
news:Qotz4.1812$74.26417 at newsc.telia.net...
> 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