[Tutor] Executing more than one program at a time

Antone antone.heyward@verizon.net
Wed Apr 9 23:03:02 2003

This how I do it. This way you create a separate process for the =
program you want to run. This uses the win32process module. If your
programming on windows its great.

def viewfile():
    si =3D win32process.STARTUPINFO()
    viewfile =3D 'notepad.exe '+ self.filename
    info =3D win32process.CreateProcess(None,viewfile,None,None,0, \

Self.filename =3D "c:\whateverfile.txt"

-----Original Message-----
From: tutor-admin@python.org [mailto:tutor-admin@python.org] On Behalf =
Jeff Shannon
Sent: Wednesday, April 09, 2003 1:12 PM
To: tutor@python.org
Cc: Henry Steigerwaldt
Subject: Re: [Tutor] Executing more than one program at a time

(I seem to be having some trouble with my mailer.  If this arrives=20
multiple times, please disregard the extras.)

Henry Steigerwaldt wrote:

 >To All:
 >How does one execute more than one program at a
 >time in Python?
 >Within my program, I display a canvas, but then when
 >I try to start a Windows program from within this
 >program, nothing happens. It is as if the computer is
 >still fixed on the canvas that is displayed and can't do  >anything =

It's hard to say without looking at your code, exactly what is =
Is your canvas window responding to appropriate events? Where in your =
are you trying to start this other program?

One possibility that occurs to me is that you may be starting the=20
GUI's message loop, and then trying to launch the other program=20
*after* you start the message loop, in that same segment of code.=20
This won't work, because when you start a message loop, your program=20
remains inside of that loop until it shuts down.  You can either start=20
the outside program (using os.popen() or os.system("start ..."),=20
depending on your exact needs) before you enter the message loop, or=20
from some event handler (which will be called from inside the message=20

If this doesn't help, feel free to post a short bit of code that =
what's happening.

Jeff Shannon
Credit International

Tutor maillist  -  Tutor@python.org