[pygtk] Updating widget causes app to freeze

Saftoiu, Claudiu Claudiu_Saftoiu at brown.edu
Fri Apr 4 06:36:19 WST 2008


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


More information about the pygtk mailing list