Reputation: 149
I am working on the graphical user interface of a machine. It uses comboboxes in a window that can be redrawn at any time in the main thread, outside the main loop (using the idle_add function inside the gtk-lock). This will happen when a certain button -a real one, not a widget- is pressed on the machine. If this happens while the combobox is open, I get a Gtk-Warning: assertion 'WIDGET REALIZED FOR EVENT' failed and my program hungs.
I tried to add the code:
combo.set_active(-1)
while gtk.events_pending():
gtk.main_iteration()
but this didn't solve the problem.
I have been looking for functions like combo.is_open() or combo.close() but they don't seem to exist. The signals related to a combo are 'changed','move-active','pop-up' and 'pop-down' but the first is only sent when a text is selected in the combo and the other ones are keybinding signals.
Is there any way to check if a combo is open (has been selected) ?
Upvotes: 2
Views: 743
Reputation: 399753
Use the popup-shown
property.
The documentation even tells you to connect to notify::popup-shown
which sounds like just what you need.
Upvotes: 3