Thanks John! That did the trick. I'm just about finished with a gui
for ImapGrab.
Here's my final generic code:
--------------------------
gobject.io_add_watch(command.stdout, gobject.IO_IN | gobject.IO_HUP,
self.read_output)
....
def read_output(self, source, condition):
if condition == gobject.IO_IN:
line = source.readline()
self.txtbuffer.insert_at_cursor(line)
self.txtview.scroll_to_mark(self.txtbuffer.get_insert(), 0)
if condition == gobject.IO_HUP:
self.txtbuffer.insert_at_cursor("Command finished.")
return False
return True
--------------------------
Avast!
Daniel Roesler
[email protected]
On 1/22/09, John Finlay <[email protected]> wrote:
> Daniel Roesler wrote:
>> Ok, I tried that, but it's giving an error about the number of
>> arguments sent to read_output. "TypeError: display_details() takes
>> exactly 2 arguments (3 given)"
>>
>> Here's my code:
>> --------------------------
>> gobject.io_add_watch(command.stdout, gobject.IO_IN | gobject.IO_HUP,
>> self.read_output)
>> ....
>>
>> def read_output(source, condition):
>> if condition == gobject.IO_IN:
>> line = source.readline()
>> self.txtbuffer.insert_at_cursor(line)
>> if condition == gobject.IO_HUP:
>> self.txtbuffer.insert_at_cursor("Command finished.")
>> return False
>> return True
>> --------------------------
>>
>> Any ideas on why this is occurring?
>>
> You passed io_add_watch a class method as the callback - the first arg
> of the classmethod must be self so prepend self to the method definition
> params:
>
> def read_output(self, source, condition):
>
> John
>
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/