Hi everyone
    I know the method:
gtk.Widget.set_size_request

    def set_size_request(*width*, *height*)

*width* :
the width the widget should request, or -1 to unset

*height* :
the height the widget should request, or -1 to unset

The set_size_request() method sets the minimum size of a widget to the
values specified by *width* and *height*. You can use this method to force a
widget to be either larger or smaller than it normally would be. In most
cases, the 
gtk.Window.set_default_size()<class-gtkwindow.html#method-gtkwindow--set-default-size>
is
a better choice for toplevel windows than this method. Setting the default
size will still allow users to shrink the window but setting the size
request will force them to leave the window at least as large as the size
request. When dealing with window sizes, the
gtk.Window.set_geometry_hints()<class-gtkwindow.html#method-gtkwindow--set-geometry-hints>
can
be a useful method as well.
Note

There is an inherent danger when setting any fixed size - themes,
translations into other languages, different fonts, and user action can all
change the appropriate size for a given widget. So, it's basically
impossible to hard code a size that will always be correct.

The size request of a widget is the smallest size a widget can accept while
still functioning well and drawing itself correctly. However in some strange
cases a widget may be allocated less than its requested size, and in many
cases a widget may be allocated more space than it requested. If the size
request in a given direction is -1 (unset), then the "natural" size request
of the widget will be used instead. Widgets can't actually be allocated a
size less than 1 by 1, but you can pass 0,0 to this method to mean "as small
as possible".


    but when I test the method by using the follow code

        def __init__(self):

        # Create a new window

        self.Window = gtk.Window(gtk.WINDOW_TOPLEVEL)

        self.Button=gtk.Button("Hello")

        self.Window.add(self.Button)

        self.Button.set_border_width(0)

        self.Button.set_size_request(100,400)

        self.Window.set_default_size(200,600)

        self.Button.show()

        self.Window.show()



    the default window's width is 200,and height is 600,but the button fill
the window,do I make something wrong?
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to