Has anyone succeeded in creating popup menus with PyGtk?  I tried and
failed -- but then, I'm fairly new at Gtk, so I might be doing
something wrong on that front.  Here is the extract from the code I've 
tried to run:

from gtk import *
from GDK import *

class someclass (GtkWindow):
    def __init__ (self):
        GtkWindow.__init__ (self)
        self.set_events (BUTTON_PRESS_MASK)
        self.signal_connect ("button_press_event", self.display_menu)
        self.menu = self.create_menu ()

    def create_menu (self):
        menu = GtkMenu ()
        item = GtkMenuItem ("Change Directory...")
        item.connect ("activate", self.menu_change_directory)
        menu.append (item)
        item = GtkMenuItem ("Exit")
        item.connect ("activate", mainquit)
        menu.append (item)
        return menu

    def menu_change_directory (self, widget, event):
        pass     # just testing

    def display_menu (self, widget, event):
        print event
        self.menu.popup ()              # !!!!! What do I put here?
        return TRUE

someclass().show_all()
mainloop ()

I have little clue as to what 6 arguments menu.popup() expects -- I
intuited that the last two should be event.button and event.time, but
I still don't know about the rest.  I ventured with `widget' as the
first one, but am still mystified about the second, and the callable
function is also strange.  testgtk.py doesn't attempt to create popup
menus, either.

Can somebody please help?
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]

Reply via email to