Reputation: 2144
I'm new to pyGTK, and now I'm trying to create a menubar with a fixed layout, but I only get a background on the items, not on the entire bar. My code:
import gtk
class App(gtk.Window):
def __init__(self):
super(App,self).__init__()
self.set_size_request(640,480)
self.set_position(gtk.WIN_POS_CENTER)
menubar = gtk.MenuBar()
menu_file= gtk.Menu()
menuitem_file = gtk.MenuItem("File")
menuitem_file.set_submenu(menu_file)
menuitem_exit = gtk.MenuItem("Exit")
menuitem_exit.connect("activate",gtk.main_quit)
menu_file.append(menuitem_exit)
menubar.append(menuitem_file)
fixed = gtk.Fixed()
vbox = gtk.VBox(False, 2)
vbox.pack_start(menubar, False, False, 0)
fixed.add(vbox)
self.add(fixed)
self.connect("destroy",gtk.main_quit)
self.show_all()
App ()
gtk.main ()
Upvotes: 3
Views: 342
Reputation:
You need to make vbox
request size, e.g. add vbox.set_size_request (300,50)
and see the difference. It is not correct size, but then I don't know why you use gtk.Fixed
at all. In 99.95% of case you don't need gtk.Fixed
. And especially if you are new to GTK+ you might think you need it while you actually don't.
Upvotes: 1