Gtk.Table

const Gtk = imports.gi.Gtk;

let table = new Gtk.Table({
    column_spacing: value,
    homogeneous: value,
    n_columns: value,
    n_rows: value,
    row_spacing: value,
});
  

The Gtk.Table functions allow the programmer to arrange widgets in rows and columns, making it easy to align many widgets next to each other, horizontally and vertically.

Tables are created with a call to Gtk.new, the size of which can later be changed with Gtk.resize.

Widgets can be added to a table using Gtk.attach or the more convenient (but slightly less flexible) Gtk.attach_defaults.

To alter the space next to a specific row, use Gtk.set_row_spacing, and for a column, Gtk.set_col_spacing. The gaps between <emphasis>all</emphasis> rows or columns can be changed by calling Gtk.set_row_spacings or Gtk.set_col_spacings respectively. Note that spacing is added <emphasis>between</emphasis> the children, while padding added by Gtk.attach is added <emphasis>on either side</emphasis> of the widget it belongs to.

Gtk.set_homogeneous, can be used to set whether all cells in the table will resize themselves to the size of the largest widget in the table.

<note> Gtk.Table has been deprecated. Use Gtk.Grid instead. It provides the same capabilities as GtkTable for arranging widgets in a rectangular grid, but does support height-for-width geometry management. </note>

Hierarchy

  • GObject.Object
    • GObject.InitiallyUnowned
      • Gtk.Widget
        • Gtk.Container
          • Gtk.Table