[Glade-users] aboutdialog

Juan Pablo Ugarte juanpablougarte at gmail.com
Wed Aug 29 23:27:35 UTC 2012


On Thu, 2012-07-19 at 07:54 -0500, John Thornton wrote:
> This is my first post to the list... and I'm pretty green with Glade3.
> 
> I'm using Ubuntu 10.04, Glade 3.6.7, Python 2.6.5 and I'm trying to
> figure out how the close button is supposed to work. I've searched the
> web and failed. 
> 
> I've managed to show the about window with this short program but can
> not figure out how to connect up the Close button.

You need to connect to the delete event
See
http://developer.gnome.org/gtk/2.24/GtkWidget.html#GtkWidget-delete-event

> 
> #!/usr/bin/env python
> 
> try:
>   import pygtk
>   pygtk.require('2.0')
> except:
>   pass
> try:
>   import gtk
>   import gtk.glade
> except:
>   print('GTK not available')
>   sys.exit(1)
> 
> class Buglump:
> 
>   def on_window_destroy(self, object, data=None):
>     print "quit with cancel"
>     gtk.main_quit()
> 
>   def on_gtk_quit_activate(self, menuitem, data=None):
>     print "quit from menu"
>     gtk.main_quit()
> 
>   def on_gtk_about_activate(self, menuitem, data=None):
>     print "help about selected"
>     self.aboutdialog.show()
> 
> # This does not get called so I assume I'm using the wrong thing
>   def on_aboutdialog_close(self, dialog, data=None):
>     print "help about close selected"
>     self.aboutdialog.hide()
> 
>   def __init__(self):
>     self.eval_string=""
>     self.gladefile = "tutorial-7.glade"
>     self.builder = gtk.Builder()
>     self.builder.add_from_file(self.gladefile)
>     self.builder.connect_signals(self)
>     self.window = self.builder.get_object("window")
>     self.aboutdialog = self.builder.get_object("aboutdialog")
>     self.window.show()
> 
> if __name__ == "__main__":
>   main = Buglump()
>   gtk.main()
> 
> Thanks
> John
> 
> _______________________________________________
> Glade-users maillist  -  Glade-users at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/glade-users




More information about the Glade-users mailing list