Gtk.Grid

const Gtk = imports.gi.Gtk;

let grid = new Gtk.Grid({
    column_homogeneous: value,
    column_spacing: value,
    row_homogeneous: value,
    row_spacing: value,
});
  

GtkGrid is a container which arranges its child widgets in rows and columns. It is a very similar to Gtk.Table and Gtk.Box, but it consistently uses Gtk.Widget's Gtk.margin and Gtk.expand properties instead of custom child properties, and it fully supports <link linkend="geometry-management">height-for-width geometry management</link>.

Children are added using Gtk.attach. They can span multiple rows or columns. It is also possible to add a child next to an existing child, using Gtk.attach_next_to. The behaviour of GtkGrid when several children occupy the same grid cell is undefined.

GtkGrid can be used like a Gtk.Box by just using Gtk.Container.prototype.add, which will place children next to each other in the direction determined by the Gtk.orientation property.

Hierarchy

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