Hi.
Test this...
import gtk
class App:
def __init__(self):
self.ventana = gtk.Window()
self.ventana.set_default_size(100, 100)
self.ventana.set_position(gtk.WIN_POS_CENTER)
self.hbox1 = gtk.HBox()
self.hbox2 = gtk.HBox(True)
self.button1 = gtk.Button("1234")
self.button2 = gtk.Button("123")
self.button3 = gtk.Button("12")
self.hbox2.pack_start(self.button1, False)
self.hbox2.pack_start(self.button2, False)
self.hbox2.pack_start(self.button3, False)
self.hbox1.pack_start(self.hbox2, False)
self.ventana.add(self.hbox1)
self.ventana.show_all()
self.ventana.connect("destroy", lambda e:gtk.main_quit())
App()
gtk.main()
Regards.
Cris.
--------- Mensaje reenviado --------
> De: Jérôme <[email protected]>
> Para: [email protected]
> Asunto: [pygtk] Gtk.Box, homogeneous and expand
> Fecha: Tue, 3 Jan 2012 14:42:27 +0100
>
> Hi.
>
> There's something I don't get with the behaviour of homogeneous in Gtk.Box. I
> guess there must be a reason for it working this way. I just don't get the
> logic.
>
> From http://pygtk.org/pygtk2tutorial/sec-DetailsOfBoxes.html :
>
> "The homogeneous argument [... ]controls whether each object in the box has
> the same size."
>
> "If homogeneous is set, then "the pack routines function essentially as if
> the expand argument was always turned on."
>
> Though it works "as if the expand argument was always turned on", "each
> object in the box has the same size" is not really what I see.
>
> What I see :
> ----------
>
> 1.a/
> homogeneous = True
> expand = whatever
> fill = False (for all objects)
> -> Objects are scattered along the line (it is a HBox), with space in
> between. They may be provided equal space, but don't actually fill it, so
> they appear with different sizes.
>
> [ |a| |abc| || ]
>
>
> 1.b/
> homogeneous = True
> expand = whatever
> fill = True (for all objects)
> -> Objects use all the line and are of equal size
>
> [| a || abc || | ]
>
>
> What I would expect :
> -------------------
>
> 2.a/
> homogeneous = True
> expand = False
> fill = whatever
> -> Objects would be of the same size : the size of the largest one, and they
> would be left-aligned (pack_start() being used).
>
> [| a ||abc|| | ]
>
>
> 2.b/
> homogeneous = True
> expand = True
> fill = False
> -> Objects would be of the same size : the size of the largest one, and they
> would be scattered along the line with space in between.
>
> [ | a | |abc| | | ]
>
>
> 2.c/
> homogeneous = True
> expand = True
> fill = True
> -> Objects would be of the same size and fill the line.
>
> [| a || abc || |]
>
>
> This seems more logical to me. I can't figure out why it does not work this
> way.
>
> Besides, I don't see how to obtain 2.a/ any other way.
>
> Am I the only one who would expect things to work this way (or at least a
> different way) ?
>
> --
> Jérôme
> _______________________________________________
> pygtk mailing list [email protected]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/