Re: Flowbox: widget expanding
- From: Cedric Bellegarde <gnumdk gmail com>
- To: Tristan Van Berkom <tristan upstairslabs com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Flowbox: widget expanding
- Date: Wed, 05 Nov 2014 15:35:50 +0100
Thanks, it works
https://github.com/gnumdk/lollypop/commit/3a715b75c065d74d68d3c5896b61dcb18822a265
regards,
--
Cédric Bellegarde
Le mer. 5 nov. 2014 à 13:24, Tristan Van Berkom
<tristan upstairslabs com> a écrit :
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]