[pygtk] Help on notebook tab
jo Maquiling
jomc_jr at yahoo.com
Sat Oct 14 07:37:30 WST 2006
Hi I'm newbie in pygtk.
I'm trying to figure out how to put a popup menu in a pagetab of a notebook which will display
the "Close Tab" in one of the menu item in the popup menu (like the popup menu on the tab of
firefox). I thought before that when activate the popup_enable() the menu will display so but it
turns out that the display is tab label in the notebook.
I've found some proposed solution here , which is shown in the code below yet when
i've tried them my notebook just display a page with blank tab.The label is not displayed
and that the menu also is not displayed. Is there somebody here in the group
who successfully tried to put a popup menu in the pagetab? Please help, Thanks..
tab_label_box = gtk.EventBox()
tab_label = gtk.Label("Some label here")
tab_label_box.add(tab_label)
tab_label_box.connect('event', on_tab_click, your_page_widget)
notebook.append_page(your_page_widget, tab_label_box)
def on_tab_click(self, widget, event, child):
if event.type == gtk.gdk.BUTTON_PRESS:
n = notebook.page_num(child)
# this will automagically switch to whatever page you click on
notebook.set_current_page(n)
if event.button == 3:
menu = create_a_menu() # I still use the ItemFactory
menu.popup(None, None, None, event.button, event.time)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20061013/43ca562a/attachment.htm
More information about the pygtk
mailing list