Gtk2::AspectFrame(3)

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

πŸ’– Gtk2::AspectFrame β€” bestie, it's the wrapper for GtkAspectFrame

okay so picture this: you've got a frame, right? and you want it to keep its ~proportions~ no matter how the window gets dragged around. that's literally it. that's the whole gig. Gtk2::AspectFrame is the Perl wrapper for GtkAspectFrame, and she is here to keep your aspect ratio from being a mess. ✨


🌈 HIERARCHY

the family tree, and yes she's at the very bottom of it, deep in the lineage, main character of her own little branch:

  Glib::Object
  +----Glib::InitiallyUnowned
       +----Gtk2::Object
            +----Gtk2::Widget
                 +----Gtk2::Container
                      +----Gtk2::Bin
                           +----Gtk2::Frame
                                +----Gtk2::AspectFrame

like, six levels of inheritance before you even get to her. the way that Gtk2::Frame is her direct parent and she just builds on top of it? obsessed. πŸŽ€


πŸ¦‹ INTERFACES

she also plays nice with these:

  • Glib::Object::_Unregistered::AtkImplementorIface
  • Gtk2::Buildable

iykyk, accessibility and builder support just come free. slay. πŸ’…


✨ METHODS ✨

🌸 widget = Gtk2::AspectFrame->new ($label, $xalign, $yalign, $ratio, $obey_child)

the constructor, the origin story, the birth of your frame. here's what you're handing her:

  • $label β€” a string, or undef if you're feeling mysterious and label-less (string or undef)
  • $xalign β€” a double (double)
  • $yalign β€” a double (double)
  • $ratio β€” a double (double)
  • $obey_child β€” a boolean (boolean)

πŸŽ€ $aspect_frame->set_params ($xalign, $yalign, $ratio, $obey_child)

change your mind later? totally valid. this lets you re-set the whole vibe after the fact:

  • $xalign β€” a double (double)
  • $yalign β€” a double (double)
  • $ratio β€” a double (double)
  • $obey_child β€” a boolean (boolean)

πŸ‘‘ PROPERTIES

the full property roster, no skips, no cuts:

  • 'obey-child' (boolean : default true : readable / writable / private / static-nick / static-blurb) β€” Force aspect ratio to match that of the frame's child
  • 'ratio' (float : default 1 : readable / writable / private / static-nick / static-blurb) β€” Aspect ratio if obey_child is FALSE
  • 'xalign' (float : default 0.5 : readable / writable / private / static-nick / static-blurb) β€” X alignment of the child
  • 'yalign' (float : default 0.5 : readable / writable / private / static-nick / static-blurb) β€” Y alignment of the child
note the defaults bestie β€” obey-child is true out the gate, and ratio is 1. don't come for me, that's just what she ships with. 🫢

πŸ’œ SEE ALSO

go read these too, they're the whole friend group:

Gtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget, Gtk2::Container, Gtk2::Bin, Gtk2::Frame


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 was documented with perl v5.42.0, dated 2025-07-25, and it's a Gtk2::AspectFrame(3) situation from the User Contributed Perl Documentation. go forth and keep those ratios cute. periodt. πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from