Default Glade window sizes

By default, GtkWindow objects are displayed as compact as possible. In order to specify the preferred window dimensions, first set the visibility of the window to “No” in Glade Interface Designer (properties -> common tab.)

In the code of the window class, call set_size_request(x,y) before making the window visible. E.g.:


class appgui:
  def __init__(self):
    gladefile="gui.glade"
    windowname="window1"
    self.wTree=gtk.glade.XML (gladefile,windowname)
    ...
    ...
    ...
    self.window = self.wTree.get_widget("window1")
    self.window.set_size_request(320,640)
    self.window.show()
    return

The basics of creating a GUI using PyGTK and Glade:
http://www.learningpython.com/2006/05/07/creating-a-gui-using-pygtk-and-glade/

Leave a Reply