Python Forum
Pygobject Menu And Notebook?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pygobject Menu And Notebook?
#1
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
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020