Gtk.AspectFrame

const Gtk = imports.gi.Gtk;

let aspect_frame = new Gtk.AspectFrame({
    obey_child: value,
    ratio: value,
    xalign: value,
    yalign: value,
});
  

The Gtk.AspectFrame is useful when you want pack a widget so that it can resize but always retains the same aspect ratio. For instance, one might be drawing a small preview of a larger image. Gtk.AspectFrame derives from Gtk.Frame, so it can draw a label and a frame around the child. The frame will be "shrink-wrapped" to the size of the child.

Hierarchy

  • GObject.Object
    • GObject.InitiallyUnowned
      • Gtk.Widget
        • Gtk.Container
          • Gtk.Bin
            • Gtk.Frame
              • Gtk.AspectFrame