[pygtk] Help on notebook tab

jo Maquiling jomc_jr at yahoo.com
Sat Oct 14 10:45:23 WST 2006


sorry to you all ...i forgot to include tab_label.show() that why the label is not showing
anyway i've solved my problem..thanks
----- Original Message ----
From: jo Maquiling <jomc_jr at yahoo.com>
To: PyGTK <pygtk at daa.com.au>
Sent: Saturday, October 14, 2006 9:37:30 AM
Subject: [pygtk] Help on notebook tab

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)


_______________________________________________
pygtk mailing list   pygtk at daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/






-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20061013/bf33fb17/attachment.htm


More information about the pygtk mailing list