Re: Flowbox: widget expanding



On Wed, 2014-11-05 at 10:56 +0100, Cedric Bellegarde wrote:
Here the code:

First, please remember to Reply-All or reply to the list, this is not
a private discussion I'm having.

#!/usr/bin/python
from gi.repository import Gtk


win = Gtk.Window()
flow = Gtk.FlowBox()
b1 = Gtk.Button("plop")
b1.set_property("vexpand", False)
flow.set_property("vexpand", False)
flow.insert(b1, -1)
win.add(flow)
win.connect("delete-event", Gtk.main_quit)
win.show_all()
Gtk.main()

When you say that a widget will not 'expand', it means that it does not
want any of the left over space beyond it's request which is left over
from that widget's siblings.

If there is only one widget, or if none of the siblings ask to expand,
then it is the same as all widgets expanding and extra space will be
distributed evenly.

By default the halign and valign properties are set to GTK_ALIGN_FILL,
which means after the parent has decided on the space to allocate it's
child, that child will 'fill' the allocated space.

You can either add siblings which do expand to your UI, in which case
any extra space will only be given to widgets which do expand, or
alternatively you can accept that the single button in the UI you've
created will receive all the space, and tell it how to align itself
in the allocated space using the haligh/valign properties.

Cheers,
    -Tristan




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]