pygtk combobox 'changed' does not work
I'm using pygtk then i used gtk.Combobox when i try to connect on chenged event its workin开发者_JS百科g but when i try to select an item that is already selected the changed method does not triggered since the selection does not changed..
so my question is how to connect the changed event even thought the selection does not changed tnx in advance
Well ... The changed event means just what it's called, that the selection has changed.
I suggest trying to listen to the popdown
signal, which I believe is emitted when the menu closes.
If that doesn't work, perhaps notify::popup-shown can work. The ComboBox has a property called popup-shown
, so listening to notifications when that property changes, and then checking if it's a transition from TRUE
to FALSE
, should help:
combo.connect("notify::popup-shown", popup_shown_callback)
In the callback, you can access the property value like this (assuming PyGTK 2.8 or later):
print "mycombo's popup-shown property is:", mycombo.props.popup_shown
I'm not 100% sure that the dash is mapped into an underscore; you will have to test this.
精彩评论