[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 =
external
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, \
=
win32process.NORMAL_PRIORITY_CLASS, \
None,None,si)
Self.filename =3D "c:\whateverfile.txt"
Viewfile()
-----Original Message-----
From: tutor-admin@python.org [mailto:tutor-admin@python.org] On Behalf =
Of
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 =
else.
>
It's hard to say without looking at your code, exactly what is =
happening.
Is your canvas window responding to appropriate events? Where in your =
code
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
loop).
If this doesn't help, feel free to post a short bit of code that =
illustrates
what's happening.
Jeff Shannon
Technician/Programmer
Credit International
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor