(GTK+ 3.4.2, Python 3.2.3, Linux Mint Debian Edition, Cinnamon Desktop)
I want to center a window using Gtk.WindowPosition.CENTER. The window contains a GtkNotebook. As soon as I add a page to that notebook, the window will not be centered anymore on execution, but it will be placed in the top left corner of the screen. Why is that and what can be done about it? Thank you!
Code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
from gi.repository import Gtk
class MyWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="Hello World")
self.set_position(Gtk.WindowPosition.CENTER)
self.set_default_size(400, 200)
self.notebook01 = Gtk.Notebook()
self.add(self.notebook01)
self.box01 = Gtk.Box(False, 0)
self.label01 = Gtk.Label("Page 1")
# uncomment next line to see the effect
#self.notebook01.insert_page(self.box01, self.label01, 0)
win = MyWindow()
win.connect("delete-event", Gtk.main_quit)
win.show_all()
Gtk.main()