[Tkinter-discuss] Dynamic output of "DOS" command in tkinter

Martin Franklin mfranklin1 at gatwick.westerngeco.slb.com
Fri Apr 25 08:48:31 CEST 2008


AbsoluteMatt wrote:
> Hi Guys,
> 
> This is my first post here and my first time developing a tkinter app - so
> please go easy:-) I have to say I have found it really nice so far, but am
> struggling on one point. 
> 
> What I want to be able to do is take a system command and "pipe" it to a
> scrollable window, however I would like it to follow the execution of the
> command dynamically. The command that I am running is not one that will
> execute in a few seconds allowing me to send the result to a scrollable
> window - which I understand how to do. 
> The link below shows an example of someone doing this:
> http://mail.python.org/pipermail/python-list/2004-September/281344.html
> 
> What I am actually doing is running an oracle IMP command and would like to
> follow the imported tables/rows etc from the app
> 
> Any suggestion about how to display in this way do this would be much
> appreciated.
> 
> Many Thanks,
> 
> Matt
> 
> 

Hi Matt,

this is not so much a tkinter problem, more a subprocess / popen thing :)

I've done this in the past with a simple while 1: loop...


proc = os.popen("imp big_oracle_xport_file.exp")

while 1:
     line = proc.readline()
     if not line:
         break
     textBox.write(line)

of course this will block and wait for the command to write another line 
to stdout... I'm sure there are better ways to do this by now, its been 
a while since I looked at the popen family (subprocess module now too I 
think...?) in any case the main python list would be my next stop after 
I checked the python doc's for popen, subprocess, command etc etc :)

Cheers
Martin

-- 
signature file not found, must be something I ate


More information about the Tkinter-discuss mailing list