[pygtk] popup menu

Peter Morgan pm at daffodil.uk.com
Mon Dec 18 06:45:17 WST 2006


I got the statusIcon working which is cool

When I right click I want a popup menu to occur which it does with the 
code below..

However I have to hold down the right mouse button otherwise it dissapears.

Dont know where to go from here or am I missing something obvious?

tia

Pete

    def on_status_icon_right_clicked(self, widget, button,activate_time):
        print "Right Click"
        popupMenu = gtk.Menu()
        menuPopup1 = gtk.ImageMenuItem (gtk.STOCK_OPEN)
        popupMenu.add(menuPopup1)
        menuPopup2 = gtk.ImageMenuItem (gtk.STOCK_OK)
        popupMenu.add(menuPopup2)
        popupMenu.show_all()
        # parent_menu_shell, parent_menu_item, func, button, 
activate_time, data=None
        popupMenu.popup(None, None,             None,         
1,             0)
        #def show_menu(self, status_icon, button, activate_time, arg0=None):
        #self.menu.popup(None, None, None, button, activate_time)


More information about the pygtk mailing list