[pygtk] mouse clicked signal is lost after widget reactivation
Cristiano Otto Von Trompczynski
cris at mandriva.com.br
Fri Apr 21 02:54:04 WST 2006
Hi all,
I have tried to use the 'clicked' signal for catching keyboard and mouse
events on button. But If I put my mouse pointer over the deactivated button
and after that I check the checkbutton activating the button (by
button.set_sensitive callback) but without removing the mouse pointer from
button, when the button is reactivated I have to leave and
enter into the button widget with mouse to catch the mouse 'clicked' signal
again (see example below). This is a problem when users don't remove the
mouse pointer from widget while reactivating button. It seems that mouse
click doesn't work (if they don't move the mouse out and into the widget
again). Does anybody know how could I workaround this problem?
example:
-------------------------------------------
#!/usr/bin/python
import gtk
window = gtk.Window()
hbox = gtk.HBox()
window.add(hbox)
button = gtk.Button("Click me")
def callback(button):
print "clicked signal..."
button.connect("clicked", callback)
def callback(button):
print "pressed signal..."
button.connect("pressed", callback)
button.set_sensitive(False)
checkbox = gtk.CheckButton("enable/disable BUTTON")
def toggled(checkbox):
button.set_sensitive(checkbox.get_active())
checkbox.connect("toggled", toggled)
checkbox.grab_focus()
hbox.pack_start(checkbox, expand=True, fill=True)
hbox.pack_start(button, expand=True, fill=True)
def callback(win, data):
gtk.main_quit()
return True
window.connect("delete-event", callback)
checkbox.show()
button.show()
hbox.show()
window.show()
while gtk.events_pending():
gtk.main_iteration()
gtk.main()
-------------------------------------------------
Regards,
Cristiano Otto Von Trompczynski
Mandriva Conectiva
www.mandriva.com
www.conectiva.com.br
More information about the pygtk
mailing list