starting Comands from Python

Syver Enstad syver-en+usenet at online.no
Mon Mar 11 18:00:49 EST 2002


Werner Hartnagel <werner.hartnagel at web.de> writes:

> Hi
> 
> Im a Python newbie and starting a small Project to learn Python
> better.
> 
> Its a GUI for the Image Magick Convert Tool.
> The Application has a GtkCList with the Files to Convert.
> 
> My Problem is I dont understand how to start a Application (convert)
> as
> 
> a new Process. I use "posix.system(cmd_str)" to Test the Program, and
> of
> 
> course the GUI freeze :-(

I think you should use os.system (It's the same but portable).

> It should wait for finish converting the File and start start again if
> 
> not "Cancel" is selected.

Put the code starting the process in a threading.Thread derived object
and let the gui set some flag that the thread can read and abort when
the user hits cancel.

Check out the threading module documentation to see how to use it.

-- 

Vennlig hilsen 

Syver Enstad



More information about the Python-list mailing list