GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Fri Aug 01, 2014 10:31 pm

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Gtk.WindowPosition.CENTER doesn't work with notebook
PostPosted: Tue Feb 19, 2013 6:17 am 
Offline

Joined: Mon Feb 18, 2013 11:13 pm
Posts: 3
(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()


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group