[pygtk] app freeze problem

Brian dol-sen at telus.net
Sat Apr 1 08:42:47 WST 2006


On Fri, 2006-31-03 at 17:55 -0500, Hussein Vastani wrote:
> Hello All, 
> In my program I have gobject.io_add_watch waiting on a receive socket and a 
> callback passed to it as parameter which gets called when ever some data 
> arrives on that socket. 
> Now the problem is that the data is arriving at a very fast rate. say 60 to 
> 100 times a second. My callback gets called successfully and in my callback I 
> parse this data and display it on a treeview ( using store.set_value() method 
> ).
> My callback is not long and computational but my treeview does not display the 
> data and my application becomes unresponsive. 
> Any suggestions on handling this scenario? I tried handle_pending_events but 
> that did not help much ( i guess coz i have soo many io events pending )
> 
> Any help is appreciated
> Thanks
> 
> Hussein Vastani
> 

I have found that when gtk gets rapid updates to a view it usually stays
blank until it gets a chance to redraw the screen.  You could put a
counter in place before you do the callback and pause it from time to
time so the screen can re-draw.  Horky I know.  We also found that
updating a lot of data to a treeview model goes a lot faster if you
switch the treemodel out for a blank one while you add info to the real
one, then switch it back when finished.

Personally I have never had any luck in trying to run the 

while gtk.events_pending()
	gtk.mainiteration()
# or something like that

It always locks up and I have to kill the app externally.
-- 
Brian <dol-sen at telus.net>



More information about the pygtk mailing list