Re: [pygtk] output gtk.TextView

2004-10-22 Thread Marcus Habermehl
Am Dienstag, den 19.10.2004, 08:36 -0400 schrieb Steve McClure:
 On Mon, 2004-10-18 at 13:05, Marcus Habermehl wrote:
  Am Sonntag, den 17.10.2004, 16:36 -0500 schrieb Skip Montanaro:
   Marcus I want to execute some shell commands in my python script. The
   Marcus output should be redirected to a gtk.TextView in real-time. How
   Marcus can I do this?
   
   Use os.popen or one of its cousins, capture the output via reads on the file
   object returned, then stuff it into the TextBuffer associated with your
   TextView widget.
  
  That I've making, now. But the text gets insert when the shell command
  is finished.
  
  Is there are not another possibility?
 
 Make sure the GUI is updated by flushing out all the events after every
 line of output.  See
 http://www.async.com.br/faq/pygtk/index.py?req=showfile=faq23.020.htp

Do you mean

while gtk.events_pending():
gtk.main_iteration()

If yes I already use it.

 Or put the popen into its own thread?

Either I makes it wrong or it doesn't work.

Now I use this for my script.

while gtk.events_pending():
gtk.main_iteration()
for item in os.popen('/sbin/removepkg '+eintrag).readlines():
while gtk.events_pending():
gtk.main_iteration()
textbuffer2.insert_at_cursor(item)

It isn't what I want. But it's an alternative.

regards

Marcus

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] output gtk.TextView

2004-10-19 Thread Steve McClure
On Mon, 2004-10-18 at 13:05, Marcus Habermehl wrote:
 Am Sonntag, den 17.10.2004, 16:36 -0500 schrieb Skip Montanaro:
  Marcus I want to execute some shell commands in my python script. The
  Marcus output should be redirected to a gtk.TextView in real-time. How
  Marcus can I do this?
  
  Use os.popen or one of its cousins, capture the output via reads on the file
  object returned, then stuff it into the TextBuffer associated with your
  TextView widget.
 
 That I've making, now. But the text gets insert when the shell command
 is finished.
 
 Is there are not another possibility?

Make sure the GUI is updated by flushing out all the events after every
line of output.  See
http://www.async.com.br/faq/pygtk/index.py?req=showfile=faq23.020.htp

Or put the popen into its own thread?

 
 regard
 
 Marcus
 
 ___
 pygtk mailing list   [EMAIL PROTECTED]
 http://www.daa.com.au/mailman/listinfo/pygtk
 Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
-- 
Steve McClure   Racemi
email: [EMAIL PROTECTED]75 5th St NE
voice: 404-892-5850 Suite 333
fax: 404-892-7215   Atlanta, GA 30308
http://www.racemi.com

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] output gtk.TextView

2004-10-18 Thread Marcus Habermehl
Am Sonntag, den 17.10.2004, 16:36 -0500 schrieb Skip Montanaro:
 Marcus I want to execute some shell commands in my python script. The
 Marcus output should be redirected to a gtk.TextView in real-time. How
 Marcus can I do this?
 
 Use os.popen or one of its cousins, capture the output via reads on the file
 object returned, then stuff it into the TextBuffer associated with your
 TextView widget.

That I've making, now. But the text gets insert when the shell command
is finished.

Is there are not another possibility?

regard

Marcus

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] output gtk.TextView

2004-10-17 Thread Marcus Habermehl
Hi.

I want to execute some shell commands in my python script. The output
should be redirected to a gtk.TextView in real-time. How can I do this?

My first idea was sys.stdin.

But I become each time an error.

TypeError: coercing to Unicode: need string or buffer, file found

regards

Marcus

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] output gtk.TextView

2004-10-17 Thread Skip Montanaro

Marcus I want to execute some shell commands in my python script. The
Marcus output should be redirected to a gtk.TextView in real-time. How
Marcus can I do this?

Use os.popen or one of its cousins, capture the output via reads on the file
object returned, then stuff it into the TextBuffer associated with your
TextView widget.

-- 
Skip Montanaro
[EMAIL PROTECTED]
http://www.mojam.com/
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/