Gtk.Layout

const Gtk = imports.gi.Gtk;

let layout = new Gtk.Layout({
    height: value,
    width: value,
});
  

Gtk.Layout is similar to Gtk.DrawingArea in that it's a "blank slate" and doesn't do anything but paint a blank background by default. It's different in that it supports scrolling natively (you can add it to a Gtk.ScrolledWindow), and it can contain child widgets, since it's a Gtk.Container. However if you're just going to draw, a Gtk.DrawingArea is a better choice since it has lower overhead.

When handling expose events on a Gtk.Layout, you must draw to GTK_LAYOUT (layout)->bin_window, rather than to GTK_WIDGET (layout)->window, as you would for a drawing area.

Hierarchy

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