I looked at the FAQ and a few other places, and there doesn't really seem
to be any documentation as to how to use an ItemFactory for popup menus in
pygtk. Here is a snippet of code that I used:
self.keyListView.connect("button_press_event",self.keyButtonImpl)
self.keyListViewPopup = gtk.ItemFactory(gtk.Menu,"<keylistpopup>")
self.keyListViewPopup.create_items([
('/Delete', None, None, 0, None),
('/Color...', None, None, 0, None),~
('/Whine 3', None, None, 0, None),
('/Whine 4', None, None, 0, None),
('/Whine 5', None, None, 0, None),
('/Whine 6', None, None, 0, None)
])
def keyButtonImpl(self, widget, event):
if event.button == 3:
self.keyListViewPopup.popup(event.x_root, event.y_root, event.button,
event.get_time())
# Event handled, don't pass it further up
return True
else:
# Event not handled, let the system do something with it
return False
Feel free to use the code or add it to the pygtk FAQ for others.
-a
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/