Gtk2::Table(3)
π Gtk2::Table β the manual, but make it cute π
okay bestie so this is Gtk2::Table, which is the Perl wrapper for GtkTable β¨ it's literally the classic "put your widgets in a grid" widget and it is so iconic for layouts. iykyk.
πΈ HIERARCHY πΈ
here's the family tree, and yes she's deep in the bloodline:
Glib::Object
+----Glib::InitiallyUnowned
+----Gtk2::Object
+----Gtk2::Widget
+----Gtk2::Container
+----Gtk2::Table
π¦ INTERFACES π¦
she also implements these, periodt:
Glib::Object::_Unregistered::AtkImplementorIface
Gtk2::Buildable
β¨ METHODS β¨
π widget = Gtk2::Table->new ($rows, $columns, $homogeneous=FALSE)
make a fresh new table, main character energy only:
$rows(integer)$columns(integer)$homogeneous(boolean)
π $table->attach ($child, $left_attach, $right_attach, $top_attach, $bottom_attach, $xoptions, $yoptions, $xpadding, $ypadding)
drop a child into the grid. every single arg, no skips:
$child(Gtk2::Widget)$left_attach(integer)$right_attach(integer)$top_attach(integer)$bottom_attach(integer)$xoptions(Gtk2::AttachOptions)$yoptions(Gtk2::AttachOptions)$xpadding(integer)$ypadding(integer)
π
$table->attach_defaults ($widget, $left_attach, $right_attach, $top_attach, $bottom_attach)
attach but with the defaults handling the rest, lowkey the lazy-girl method (affectionate):
$widget(Gtk2::Widget)$left_attach(integer)$right_attach(integer)$top_attach(integer)$bottom_attach(integer)
π integer = $table->get_col_spacing ($column)
how much space is between this column and the next one:
$column(integer)
π§ $table->set_col_spacing ($column, $spacing)
set that gap yourself:
$column(integer)$spacing(integer)
β $table->set_col_spacings ($spacing)
set the spacing for all the columns at once, efficiency queen:
$spacing(integer)
π integer = $table->get_default_col_spacing
grab the default column spacing.
π integer = $table->get_default_row_spacing
grab the default row spacing.
π boolean = $table->get_homogeneous
is she homogeneous or not, we must know.
πΈ $table->set_homogeneous ($homogeneous)
$homogeneous(boolean)
π«Ά $table->resize ($rows, $columns)
change how many rows and columns the table has:
$rows(integer)$columns(integer)
π integer = $table->get_row_spacing ($row)
the gap for this specific row:
$row(integer)
β¨ $table->set_row_spacing ($row, $spacing)
$row(integer)$spacing(integer)
π $table->set_row_spacings ($spacing)
all the rows get the same spacing, slay:
$spacing(integer)
π¦ (rows, columns) = $table->get_size
you get back a list of rows and columns. it's giving "two return values, stay ready".
Since: gtk+ 2.22
π PROPERTIES π
every one of these is readable / writable / private / static-nick / static-blurb, no cap:
'column-spacing'(Glib::UInt : default 0 : readable / writable / private / static-nick / static-blurb) β The amount of space between two consecutive columns'homogeneous'(boolean : default false : readable / writable / private / static-nick / static-blurb) β If TRUE, the table cells are all the same width/height'n-columns'(Glib::UInt : default 1 : readable / writable / private / static-nick / static-blurb) β The number of columns in the table'n-rows'(Glib::UInt : default 1 : readable / writable / private / static-nick / static-blurb) β The number of rows in the table'row-spacing'(Glib::UInt : default 0 : readable / writable / private / static-nick / static-blurb) β The amount of space between two consecutive rows
π§Έ CHILD PROPERTIES π§Έ
these live on the children, bestie, not on the table itself. all of them are readable / writable / private / static-nick / static-blurb:
'bottom-attach'(Glib::UInt : default 1 : readable / writable / private / static-nick / static-blurb) β The row number to attach the bottom of the child to'left-attach'(Glib::UInt : default 0 : readable / writable / private / static-nick / static-blurb) β The column number to attach the left side of the child to'right-attach'(Glib::UInt : default 1 : readable / writable / private / static-nick / static-blurb) β The column number to attach the right side of a child widget to'top-attach'(Glib::UInt : default 0 : readable / writable / private / static-nick / static-blurb) β The row number to attach the top of a child widget to'x-options'(Gtk2::AttachOptions : default expand,fill : readable / writable / private / static-nick / static-blurb) β Options specifying the horizontal behaviour of the child'x-padding'(Glib::UInt : default 0 : readable / writable / private / static-nick / static-blurb) β Extra space to put between the child and its left and right neighbors, in pixels'y-options'(Gtk2::AttachOptions : default expand,fill : readable / writable / private / static-nick / static-blurb) β Options specifying the vertical behaviour of the child'y-padding'(Glib::UInt : default 0 : readable / writable / private / static-nick / static-blurb) β Extra space to put between the child and its upper and lower neighbors, in pixels
π ENUMS AND FLAGS π
flags Gtk2::AttachOptions
the whole squad:
'expand'/GTK_EXPAND'shrink'/GTK_SHRINK'fill'/GTK_FILL
π« SEE ALSO π«
go read these too, they're all connected fr fr:
Gtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget, Gtk2::Container
π COPYRIGHT π
Copyright (C) 2003-2011 by the gtk2-perl team.
This software is licensed under the LGPL. See Gtk2 for a full notice.
and that's the whole page bestie π this lil doc came out of the User Contributed Perl Documentation corner of the world, generated by perl v5.42.0 and dated 2025-07-25 β like, the version and the date are literally right there in the footer, iconic. go build something cute with your grids, ily, bye πβ¨
π¦ where this page comes from
- fedora 43: perl-Gtk2 1.24993-23.fc43 Β· LicenseRef-Callaway-LGPLv2+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms