While many GUI toolkits require you to precisely place widgets in a window,
using absolute positioning, GTK+ uses a different approach.
Rather than specifying the position and size of each widget in the window,
you can arrange your widgets in rows, columns, and/or tables.
The size of your window can be determined automatically, based on the sizes
of the widgets it contains.
And the sizes of the widgets are, in turn, determined by the amount of text
they contain, or the minimum and maximum sizes that you specify, and/or how
you have requested that the available space should be shared between sets of
widgets. You can perfect your layout by specifying padding distance and
centering values for each of your widgets. GTK+ then uses all this information
to resize and reposition everything sensibly and smoothly when the user
manipulates the window.

GTK+ arranges widgets hierarchically, using containers.
They are invisible to the end user and are inserted into a window, or placed
within each other to layout components.
There are two flavours of containers: single-child
containers, which are all descendants of Gtk.Bin, and multiple-child
containers, which are descendants of Gtk.Container.
The most commonly used are vertical or horizontal boxes
(Gtk.Box) and grids (Gtk.Grid).

Boxes are invisible containers into which we can pack our widgets.
When packing widgets into a horizontal box, the objects are inserted
horizontally from left to right or right to left depending on whether
Gtk.Box.pack_start() or Gtk.Box.pack_end() is used.
In a vertical box, widgets are packed from top to bottom or vice versa.
You may use any combination of boxes inside or beside other boxes to create
the desired effect.

Gtk.Grid is a container which arranges its child widgets in rows and
columns, but you do not need to specify the dimensions in the constructor.
Children are added using Gtk.Grid.attach(). They can span multiple rows or
columns. It is also possible to add a child next to an existing child, using
Gtk.Grid.attach_next_to().

Gtk.Grid can be used like a Gtk.Box by just using
Gtk.Grid.add(), which will place children next to each other in the
direction determined by the “orientation” property (defaults to
Gtk.Orientation.HORIZONTAL).

A Gtk.ListBox is a vertical container that contains Gtk.ListBoxRow
children. These rows can by dynamically sorted and filtered, and headers can be
added dynamically depending on the row content. It also allows keyboard and
mouse navigation and selection like a typical list.

Using Gtk.ListBox is often an alternative to Gtk.TreeView, especially
when the list contents has a more complicated layout than what is allowed by a
Gtk.CellRenderer, or when the contents is interactive (i.e. has a button
in it).

A Gtk.HeaderBar is similar to a horizontal Gtk.Box, it allows
to place children at the start or the end. In addition, it allows a title to be
displayed. The title will be centered with respect to the width of the box,
even if the children at either side take up different amounts of space.

Since GTK+ now supports Client Side Decoration, a Gtk.HeaderBar can
be used in place of the title bar (which is rendered by the Window Manager).

A Gtk.HeaderBar is usually located across the top of a window and
should contain commonly used controls which affect the content below. They also
provide access to window controls, including the close window button and window
menu.

A Gtk.FlowBox is a container that positions child widgets in sequence
according to its orientation.

For instance, with the horizontal orientation, the widgets will be arranged
from left to right, starting a new row under the previous row when necessary.
Reducing the width in this case will require more rows, so a larger height
will be requested.

Likewise, with the vertical orientation, the widgets will be arranged from top
to bottom, starting a new column to the right when necessary. Reducing the
height will require more columns, so a larger width will be requested.

importgigi.require_version('Gtk','3.0')fromgi.repositoryimportGtkclassMyWindow(Gtk.Window):def__init__(self):Gtk.Window.__init__(self,title="Simple Notebook Example")self.set_border_width(3)self.notebook=Gtk.Notebook()self.add(self.notebook)self.page1=Gtk.Box()self.page1.set_border_width(10)self.page1.add(Gtk.Label('Default Page!'))self.notebook.append_page(self.page1,Gtk.Label('Plain Title'))self.page2=Gtk.Box()self.page2.set_border_width(10)self.page2.add(Gtk.Label('A page with an image for a Title.'))self.notebook.append_page(self.page2,Gtk.Image.new_from_icon_name("help-about",Gtk.IconSize.MENU))win=MyWindow()win.connect("delete-event",Gtk.main_quit)win.show_all()Gtk.main()