[pygtk] Updating widget causes app to freeze

Saftoiu, Claudiu Claudiu_Saftoiu at brown.edu
Fri Apr 4 07:57:55 WST 2008

Hello again,

Never mind about all these... I was sure they were related somehow, and they were. It has to do with
the fact that I was using threads to do the other update, but I was using python threading for the
update while using twisted's threading for everything else... this caused nasty things. I've fixed
it now, by using twisted's LoopingCall instead of python's threading, and these all work now.

Sorry for the mail list spam,
- Claudiu

-----Original Message-----
From: pygtk-bounces at daa.com.au on behalf of Saftoiu, Claudiu
Sent: Thu 4/3/2008 6:36 PM
To: pygtk at daa.com.au
Subject: [pygtk] Updating widget causes app to freeze
Hello all,

I'm not sure if this is a failure on my part to understand how GTK works, or a series of unrelated
bugs, or a series of related bugs.

I have an application which needs to dynamically create a Widget. Once it's created, every few seconds it
has to update certain parts of the widget - set some text, change some background colors, change some
tooltips, etc.

BUG 1 - Removing widget:
    I first tried to simply re-create the entire widget from scratch every time. That should certainly have
    worked. The problem is, when I did self.remove(widget), the application would freeze. I thought, maybe
    the widget is too complex to remove, so I decided to update certain parts specifically.

Updating the labels by changing their text works fine.

BUG 2 - modify_bg: 
    Like I said, set_text works well. I, however, need some labels with bg colors, so I placed some of them in
    EventBoxs. When I create the widget, calling modify_bg to set the initial color works fine. When updating
    it later, any call to modify_bg causes the app to freeze.
    I now belive bug 1 might have also been caused by this.

BUG 3 - tooltips: 
    The tooltips have to change in between updates. This works totally fine. However, if the mouse is currently
    hovered over a tooltip and the widget updates, the app freezes.

BUG 4 - adding widgets:
    Some updates require an extra button to be added or removed, for example. Adding a button once the widget
    is initially created and attaching it / packing it into a container causes the app to freeze.

Is there any function call, such as "please freeze the entire app and cancel all events while I update the
widget" and then a correspodning "OK, wake up and use those changes" ?
Or is there a better way to do these things?

Thanks for any help. If I don't get replies I'll file 4 separate bugs in bugzilla.
- Claudiu
pygtk mailing list   pygtk at daa.com.au
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

More information about the pygtk mailing list