Re: Updating a TextView with the results of a long, processor-intensive process



On Wed, Apr 14, 2004 at 11:35:42PM -0400, muppet wrote:
On Wed, 2004-04-14 at 17:31, Bob Wilkinson wrote:
If you want to use the "chew up events" trick, it works like this:

  for (0..$one_hundred_beellyun_dollars) {
     some_operation_that_takes_a_relatively_long_time();
     # run the main loop a few times to update the ui.
     Gtk2->main_iteration while Gtk2->events_pending;
  }


Thanks for the clarification.

Rather than just blather on about how it should work, i decided to write
a little proof of concept example.  This code actually works; the
scroll-to-bottom thing doesn't look so great, but i can't be arsed to
figure out why, as it's getting late and i haven't been sleeping much
lately.  I'll leave that as an exercise for the reader.  :-)


Thank you for taking the time to write this code. I shall study it,
and understand. I have found that using setlinebuf(stdout) in my C
code works wonders too while tailing an output file.

Bob
-- 
He knows not how to know who knows not also how to unknow.
                -- Sir Richard Burton

Attachment: signature.asc
Description: Digital signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]