Lennon Cook <[EMAIL PROTECTED]> wrote: > I am attempting to set a right-click context menu on a gtk.ComboBox . I have attached sample code showing what I am trying to achieve.
-- Lennon Victor Cook "He who receives an idea from me receives without lessening, as he who lights his candle at mine receives light without darkening" -- Thomas Jefferson
#!/usr/bin/python
import gtk
win = gtk.Window()
box = gtk.combo_box_new_text()
win.add(box)
for s in 'green', 'eggs', 'and', 'spam':
box.append_text(s)
menu = gtk.Menu()
menu.attach(gtk.MenuItem('Hello'), 0, 1, 0, 1)
def on_button_press(widget, event):
if event.button == 3:
menu.popup(None, None, None, event.button, event.time)
return True
return False
box.connect('button-press-event', on_button_press)
win.show_all()
gtk.main()
signature.asc
Description: PGP signature
_______________________________________________ pygtk mailing list [email protected] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
