[Tkinter-discuss] Open a Dos prompt(cmd.exe) using a GUI, thus allowing user to execute batchfile

Snakey darr_low at yahoo.com
Tue Apr 15 11:29:13 CEST 2008

I have found a way using subprocess.popen( 'cmd.exe' ).  This will spawn a
new process that does not hang the mainloop of the parent process.  However,
I also need to redirect everything the user types in the dos box back to be
processed by my GUI, without hanging the GUI when the piping is taking
place.  Can this be done??

I tried >>>

s = subprocess.popen( 'cmd.exe', stdout=subprocess.PIPE )

# when the new process ends, I do the following:

out = s.stdout.readlines()
# i do some string action on  out

Snakey wrote:
> I have created a GUI which has a button that when pressed, opens a Dos
> prompt box.  I am using os.system( '.somepath...\.\cmd.exe' ).  In this
> dos box, the user can run watever application he wants eg. execute a
> batchfile or run dos commands.   
> 1. I need the GUI to monitor this dos box such that when the user closes
> the box, the GUI is aware of this action.
> 2. I need the GUI to monitor this dos box, such that when the user
> executes a batchfle in the dos prompt box, and the batchfile ends, the GUI
> is also aware.
> Is there someway the GUI can monitor the status of the dos box?

View this message in context: http://www.nabble.com/Open-a-Dos-prompt%28cmd.exe%29-using-a-GUI%2C-thus-allowing-user-to-execute-batchfile-tp16624069p16698300.html
Sent from the Python - tkinter-discuss mailing list archive at Nabble.com.

More information about the Tkinter-discuss mailing list