""" Either commenting out the following threads call, or disabling the global
appmenu, allows the program to run after using the First Menu's About and then
closing the resulting About dialog box.
The Second Menu's About dialog box, with its different call back routine, works irregardless. """
gtk.gdk.threads_init() # Without this line program works ok
import gtk
""" Either commenting out the following threads call, or disabling the global
appmenu, allows the program to run after using the First Menu's About and then
closing the resulting About dialog box.
The Second Menu's About dialog box, with its different call back routine, works irregardless. """
gtk.gdk. threads_ init() # Without this line program works ok
window= gtk.Window( gtk.WINDOW_ TOPLEVEL) set_title( "Our Window") connect( "delete- event", lambda x,y: gtk.main_quit() )
window.
window.
window.show()
def menuitem_ response( string) : set_name( "My About Dialog")
about = gtk.AboutDialog()
about.
response = about.run()
about.destroy()
def menuitem2_ response( string) : set_name( "My About Dialog") connect( "response" , lambda x,y: x.destroy() )
about = gtk.AboutDialog()
about.
about.
about.show()
about_item = gtk.MenuItem( "About" ) connect_ object( "activate" , menuitem_response, "about")
about_item.
about_item.show()
about_item2 = gtk.MenuItem( "About" ) connect_ object( "activate" , menuitem2_response, "about")
about_item2.
about_item2.show()
menu = gtk.Menu() about_item)
menu.append(
menu2 = gtk.Menu() about_item2)
menu2.append(
root_menu = gtk.MenuItem("First Top Menu") set_submenu( menu)
root_menu.show()
root_menu.
second_menu = gtk.MenuItem( "Second Top Menu") menu.set_ submenu( menu2)
second_menu.show()
second_
vbox = gtk.VBox(False, 0)
window.add(vbox)
vbox.show()
menubar= gtk.MenuBar( ) start(menubar, False, False, 0) append( root_menu) append( second_ menu)
vbox.pack_
menubar.
menubar.
menubar.show()
gtk.main()