Python Forum

Full Version: Pygobject Menu And Notebook?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I added Notebook to my application. I used it with Grid. Now I want to add Menu. Gtk.Box () does this. But this time it gives an error and the empty window opens. What's the way to add this?

def __init__(self):
    Gtk.Window.__init__(self, title=info.__appname__)
    # self.set_default_size(500, 450)
    self.connect("destroy", Gtk.main_quit)

    vbox = Gtk.VBox()
    self.add(vbox)


    menu1 = Gtk.Menu()
    file = Gtk.MenuItem(label="_File")
    file.set_submenu(menu1)

    vbox.pack_start(menu1, False, False, 0)


    self.notebook = Gtk.Notebook()
    self.add(self.notebook)

    [..]
Quote:(gui.py:937): Gtk-CRITICAL **: 17:21:21.681: gtk_box_pack: assertion '_gtk_widget_get_parent (child) == NULL' failed

(gui.py:937): Gtk-WARNING **: 17:21:21.681: Attempting to add a widget with type GtkNotebook to a main+GUI, but as a GtkBin subclass a main+GUI can only contain one widget at a time; it already contains a widget of type GtkVBox