Gtk2::Table(3)

πŸ“¦
version 1.24993 Β· 2 versions
, in fedora 43

πŸ’– 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 (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