pygtk - What does it mean for a gtk widget to have its own window -
i trying learn pygtk , understand meaning of terms in documentation , tutorial.
according documentation
- a button object not have own window.
- widgets not receive events (widgets not have own window) not work tooltips.
so conclude tooltips not work buttons. seems wrong , example code below seems prove wrong. there don't understand meaning of terms? above statements incorrect? can explain missing here. method get_has_window() not answer same question whether tooltip work?
#!/usr/bin/env python import pygtk pygtk.require('2.0') import gtk class isbuttonnowindowwidget: def sillycallback(self, widget, data): print data if widget.get_has_window(): print "which has window" else: print "which *not* have window" def __init__(self): # create dismissable top level self.window = gtk.window(gtk.window_toplevel) self.window.connect("destroy", lambda w: gtk.main_quit()) button = gtk.button("press me") button.connect("clicked", self.sillycallback, "you have clicked button") tooltips = gtk.tooltips() # according pygtk documentation: # widgets not receive events # (widgets not have own window) # *not* work tooltips. tooltips.set_tip(button, "just press me, already!") self.window.add(button) button.show() self.window.show() def main(): gtk.main() return 0 if __name__ == "__main__": isbuttonnowindowwidget() main()
Comments
Post a Comment