Andre> I'm trying to create a menu for my application ...
...
Andre> How could I insert items inside the filemenu ?
(Warning! I'm using gtk 1.3.4 and the 20010408 snapshot of pygtk2, i.e., the
gtk-2.0 API. Your mileage may vary...)
This worked for me:
import gtk
def open(*args):
print "open"
def close(*args):
print "close"
def main():
mainwindow = gtk.GtkWindow(gtk.WINDOW_TOPLEVEL)
mainwindow.set_border_width(5)
mainwindow.set_default_size(400,300)
mainwindow.connect("destroy", gtk.mainquit)
vbox = gtk.GtkVBox()
mainwindow.add(vbox)
menubar = gtk.GtkMenuBar()
vbox.pack_start(menubar, expand=gtk.FALSE)
filemenu = gtk.GtkMenuItem("File")
menubar.add(filemenu)
filesubmenu = gtk.GtkMenu()
filemenu.set_submenu(filesubmenu)
# individual menu buttons
item = gtk.GtkMenuItem("Open")
item.connect("activate", open)
filesubmenu.add(item)
item = gtk.GtkMenuItem("Close")
item.connect("activate", close)
filesubmenu.add(item)
item = gtk.GtkMenuItem("Quit")
item.connect("activate", gtk.mainquit)
filesubmenu.add(item)
mainwindow.show_all()
gtk.mainloop()
main()
--
Skip Montanaro ([EMAIL PROTECTED])
(847)971-7098
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk