Gtk2::Label(3)
π NAME π
Gtk2::Label β bestie, it's a wrapper for GtkLabel. That's the whole vibe. It's the thing that puts words on your screen, and it does it with main character energy. π
π¦ HIERARCHY π¦
Okay so this is the family tree, and yes she comes from a long line of iconic ancestors:
Glib::Object
+----Glib::InitiallyUnowned
+----Gtk2::Object
+----Gtk2::Widget
+----Gtk2::Misc
+----Gtk2::Label
π INTERFACES π
She also implements these, because she contains multitudes:
Glib::Object::_Unregistered::AtkImplementorIface
Gtk2::Buildable
β¨ METHODS β¨
widget = Gtk2::Label->new ($str=undef)β makes you a fresh label. π$str(string or undef)
widget = Gtk2::Label->new_with_mnemonic ($str)β same deal but with mnemonic powers unlocked.$str(string)
double = $label->get_angleβ grabs the rotation angle.- Since: gtk+ 2.6
$label->set_angle ($angle)β sets the rotation angle, go off.$angle(double)- Since: gtk+ 2.6
attrlist = $label->get_attributesβ gets thePango::AttrListof style attributes.$label->set_attributes ($attrs)β sets the style attributes.$attrs(Pango::AttrList)
string = $label->get_current_uriβ gets the URI currently under the cursor, lowkey iconic.- Since: gtk+ 2.18
ellipsizemode = $label->get_ellipsizeβ how is she cutting off the text when there's no room?- Since: gtk+ 2.6
$label->set_ellipsize ($mode)β tell her where to trim.$mode(Pango::EllipsizeMode)- Since: gtk+ 2.6
justification = $label->get_justifyβ the alignment of the lines relative to each other.$label->set_justify ($jtype)β set that alignment.$jtype(Gtk2::Justification)
string = $label->get_labelβ gets the text.$label->set_label ($str)β sets the text, fr fr.$str(string)
layout = $label->get_layoutβ hands you thePango::Layout.(x, y) = $label->get_layout_offsetsβ the layout's offsets, as a cute lil pair.boolean = $label->get_line_wrapβ is line wrap on or nah?wrapmode = $label->get_line_wrap_modeβ which wrap mode tho.- Since: gtk+ 2.9
$label->set_line_wrap_mode ($wrap_mode)β set the wrap mode.$wrap_mode(Pango::WrapMode)- Since: gtk+ 2.9
$label->set_line_wrap ($wrap)β turn line wrapping on or off.$wrap(boolean)
$label->set_markup ($str)β set the text as markup.$str(string)
$label->set_markup_with_mnemonic ($str)β markup and mnemonic, the combo meal.$str(string)
integer = $label->get_max_width_charsβ the max width, counted in characters.- Since: gtk+ 2.6
$label->set_max_width_chars ($n_chars)β set that max width.$n_chars(integer)- Since: gtk+ 2.6
integer = $label->get_mnemonic_keyvalβ the mnemonic accelerator keyval, as an integer.widget or undef = $label->get_mnemonic_widgetβ the widget tied to the mnemonic, or undef if there isn't one.$label->set_mnemonic_widget ($widget)β assign the mnemonic widget.$widget(Gtk2::Widgetor undef)
$label->set_pattern ($pattern)β sets the underline pattern.$pattern(string)
$label->select_region ($start_offset=-1, $end_offset=-1)β selects a chunk of the text.$start_offset(integer)$end_offset(integer)
boolean = $label->get_selectableβ can you select the text with your mouse? π$label->set_selectable ($setting)β toggle selectability.$setting(boolean)
(start, end) = $label->get_selection_boundsβ returns integers,startandend. Simple as that.boolean = $label->get_single_line_modeβ single line mode status check.- Since: gtk+ 2.6
$label->set_single_line_mode ($single_line_mode)β flip single line mode.$single_line_mode(boolean)- Since: gtk+ 2.6
string or undef = $label->get_textβ grabs the text, might be undef, no cap.$label->set_text ($str)β sets the text.$str(string or undef)
$label->set_text_with_mnemonic ($str)β text + mnemonic, together at last.$str(string)
boolean = $label->get_track_visited_linksβ are we tracking visited links or not?- Since: gtk+ 2.18
$label->set_track_visited_links ($track_links)β toggle that tracking.$track_links(boolean)- Since: gtk+ 2.18
boolean = $label->get_use_markupβ is the text being read as XML markup?$label->set_use_markup ($setting)β toggle markup mode.$setting(boolean)
boolean = $label->get_use_underlineβ is an underline being used to signal the next character as a mnemonic accelerator?$label->set_use_underline ($setting)β toggle that underline behaviour.$setting(boolean)
integer = $label->get_width_charsβ the desired width, in characters.- Since: gtk+ 2.6
$label->set_width_chars ($n_chars)β set the desired width.$n_chars(integer)- Since: gtk+ 2.6
π PROPERTIES π
Every single one, bestie, and every one of them is private / static-nick / static-blurb β that's just how she rolls:
'angle'(double : default0: readable / writable / private / static-nick / static-blurb) β Angle at which the label is rotated πΈ'attributes'(Pango::AttrList: defaultundef: readable / writable / private / static-nick / static-blurb) β A list of style attributes to apply to the text of the label'cursor-position'(integer : default0: readable / private / static-nick / static-blurb) β The current position of the insertion cursor in chars'ellipsize'(Pango::EllipsizeMode: default"none": readable / writable / private / static-nick / static-blurb) β The preferred place to ellipsize the string, if the label does not have enough room to display the entire string'justify'(Gtk2::Justification: default"left": readable / writable / private / static-nick / static-blurb) β The alignment of the lines in the text of the label relative to each other. This does NOT affect the alignment of the label within its allocation. SeeGtkMisc::xalignfor that'label'(string : default"": readable / writable / private / static-nick / static-blurb) β The text of the label'max-width-chars'(integer : default-1: readable / writable / private / static-nick / static-blurb) β The desired maximum width of the label, in characters'mnemonic-keyval'(Glib::UInt: default0xFFFFFFVoidSymbol : readable / private / static-nick / static-blurb) β The mnemonic accelerator key for this label'mnemonic-widget'(Gtk2::Widget: defaultundef: readable / writable / private / static-nick / static-blurb) β The widget to be activated when the label's mnemonic key is pressed'pattern'(string : defaultundef: writable / private / static-nick / static-blurb) β A string with_characters in positions correspond to characters in the text to underline'selectable'(boolean : defaultfalse: readable / writable / private / static-nick / static-blurb) β Whether the label text can be selected with the mouse'selection-bound'(integer : default0: readable / private / static-nick / static-blurb) β The position of the opposite end of the selection from the cursor in chars'single-line-mode'(boolean : defaultfalse: readable / writable / private / static-nick / static-blurb) β Whether the label is in single line mode'track-visited-links'(boolean : defaulttrue: readable / writable / private / static-nick / static-blurb) β Whether visited links should be tracked'use-markup'(boolean : defaultfalse: readable / writable / private / static-nick / static-blurb) β The text of the label includes XML markup. Seepango_parse_markup()'use-underline'(boolean : defaultfalse: readable / writable / private / static-nick / static-blurb) β If set, an underline in the text indicates the next character should be used for the mnemonic accelerator key'width-chars'(integer : default-1: readable / writable / private / static-nick / static-blurb) β The desired width of the label, in characters'wrap'(boolean : defaultfalse: readable / writable / private / static-nick / static-blurb) β If set, wrap lines if the text becomes too wide'wrap-mode'(Pango::WrapMode: default"word": readable / writable / private / static-nick / static-blurb) β If wrap is set, controls how linewrapping is done
π SIGNALS π
The moments where she does something, and you can catch them:
activate-current-link(Gtk2::Label)boolean = activate-link(Gtk2::Label, string)copy-clipboard(Gtk2::Label)move-cursor(Gtk2::Label,Gtk2::MovementStep, integer, boolean)populate-popup(Gtk2::Label,Gtk2::Menu)
π ENUMS AND FLAGS π
enum Gtk2::Justification
'left'/'GTK_JUSTIFY_LEFT''right'/'GTK_JUSTIFY_RIGHT''center'/'GTK_JUSTIFY_CENTER''fill'/'GTK_JUSTIFY_FILL'
enum Gtk2::MovementStep
'logical-positions'/'GTK_MOVEMENT_LOGICAL_POSITIONS''visual-positions'/'GTK_MOVEMENT_VISUAL_POSITIONS''words'/'GTK_MOVEMENT_WORDS''display-lines'/'GTK_MOVEMENT_DISPLAY_LINES''display-line-ends'/'GTK_MOVEMENT_DISPLAY_LINE_ENDS''paragraphs'/'GTK_MOVEMENT_PARAGRAPHS''paragraph-ends'/'GTK_MOVEMENT_PARAGRAPH_ENDS''pages'/'GTK_MOVEMENT_PAGES''buffer-ends'/'GTK_MOVEMENT_BUFFER_ENDS''horizontal-pages'/'GTK_MOVEMENT_HORIZONTAL_PAGES'
enum Pango::EllipsizeMode
'none'/'PANGO_ELLIPSIZE_NONE''start'/'PANGO_ELLIPSIZE_START''middle'/'PANGO_ELLIPSIZE_MIDDLE''end'/'PANGO_ELLIPSIZE_END'
enum Pango::WrapMode
'word'/'PANGO_WRAP_WORD''char'/'PANGO_WRAP_CHAR''word-char'/'PANGO_WRAP_WORD_CHAR''none'/'PANGO_WRAP_NONE'
π«Ά SEE ALSO π«Ά
Go read these next, they're the extended universe:
Gtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget, Gtk2::Misc
π COPYRIGHT π
Copyright (C) 2003-2011 by the gtk2-perl team.
This software is licensed under the LGPL. See Gtk2 for a full notice.
okay that's the whole page bestie, mwah π
this lil masterpiece shipped with perl v5.42.0 and it's dated 2025-07-25 β the Gtk2::Label(3) era, and honestly? we ate. πβ¨
π¦ where this page comes from
- fedora 43: perl-Gtk2 1.24993-23.fc43 Β· LicenseRef-Callaway-LGPLv2+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms