great

thank you:)

I will go on learning pygtk development and also I will study glade-3



2009/12/10 John Stowers <john.stowers.li...@gmail.com>

> On Thu, 2009-12-10 at 00:02 +0800, engine spot wrote:
> > Hi John
> >     when I test your code ,I find that the button's height is
> > ok,400px,but the width is fill
> >
> >
> >     when I change vb = gtk.VBox() to vb = gtk.HBox()
> >
> >
> >     run your code ,then the width is 100px, ok,but the height is fill
> >
> >
> >     is it true I need to use gtk's another object but not HBox and
> > VBox?
> >     which object is ok?
>
> import gtk
> Window = gtk.Window(gtk.WINDOW_TOPLEVEL)
> Button=gtk.Button("Hello")
> hb = gtk.HBox()
> vb = gtk.VBox()
> hb.pack_start(vb, False, False)
> vb.pack_start(Button, False, False)
> Window.add(hb)
> Button.set_border_width(0)
> Button.set_size_request(100,400)
> Window.set_default_size(200,600)
> Window.show_all()
> gtk.main()
>
> HBox considers expand and fill pack parameters horizontally, and VBox
> considers them vertically. So depending on your GUI you sometimes need
> both.
>
> But a simple button in a window is not the best way to learn how Gtk+
> GUI packing works, it is not a real world case and will just continue to
> confuse you.
>
> I suggest using glade-3 to design some different GUIs, and experimenting
> with the effect of expand and fill when packing widgets.
>
> In general you should not set minimum/default size (this is not windows
> forms). It is best to accomplish the GUI layout you want using the
> correct application of packing rules, and correct uses of alignments and
> sizegroups.
>
> John
>
>
_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to