in reply to Re: Realtime update of a textbuffer from STDOUT/STDERR in Gtk2
in thread Realtime update of a textbuffer from STDOUT/STDERR in Gtk2
I think my problem is in the fact that everytime new data is in the filehandle, the buffer is overwritten. Is there a way to append data to the end of the buffer as it comes in?
Well, you are overwriting it with set_text. You can make a global variable, that you append to
my $buftext =''; ..... $buftext .= $sysbuffer; $buffer->set_text($buftext); # or better.....insert at the end_iter $buffer->insert( $buffer->get_end_iter, $sysbuffer );
The end_mark and end_iter concepts are hard to get right, it's best to make a few simple examples for yourself to play with them.
Also, if you read the warning messages, you should change 'add' to 'add_with_viewport' at the lines specified; it will make the scrollbars work better.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Realtime update of a textbuffer from STDOUT/STDERR in Gtk2
by fang0654 (Initiate) on Aug 31, 2007 at 20:05 UTC |