Hello everyoneQuickly copied from my current project (wndBuy is a window which is shown when a user selects a menu item):
I've used pygtk now for one project and very much dig it. Thanks for your work.
I'd really like to have a menu popup when the user right-clicks in a table cell but I haven't figured out how to do it yet. Can someone show me a snippet?
#v+
def on_trvElements_button_press_event (self, sender, ev):
if ev.button == 3:
trv, trm = self.trvElements, self.trmElements x, y = int(ev.x), int(ev.y)
ret = trv.get_path_at_pos (x, y)
if ret:
path, col, cellx, celly = ret
# this focus thing may be unneeded
trv.grab_focus()
trv.set_cursor (path, col, 0)
iter = trm.get_iter (path)
elem_id = trm.get_value (iter, 0)
self.mnuElements.popup (elem_id, self.wndBuy, ev.button, ev.time)
#v-mnuElements.popup is sth like this (it's from some wrapper classes I created for use with Glade)
#v+
def popup (self, elem_id, wndBuy, button, time):
self.elem_id = elem_id
self.wndBuy = wndBuy
self.mnuElements.popup (None, None, None, button, time)
#v--- regards, Jakub Piotr CÅapa _______________________________________________ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
