Gtk2::RadioButton(3)
π Gtk2::RadioButton β the manual, but make it cute
okay bestie, so this is the page for Gtk2::RadioButton(3), straight out of the User Contributed Perl Documentation (yes that's the manual name, it's giving "the people's docs" and honestly? iconic). It's the Perl wrapper for GtkRadioButton and it is so much easier than it sounds. sit with me, we're doing this together π«Ά
β¨ NAME β¨
Gtk2::RadioButton β it's the wrapper for GtkRadioButton, no cap.
π SYNOPSIS π
here's the vibe, copied exactly because code is sacred:
# first group
$foo1 = Gtk2::RadioButton->new (undef, 'Foo One');
$foo2 = Gtk2::RadioButton->new ($foo1, 'Foo Two');
$foo3 = Gtk2::RadioButton->new ($foo2, 'Foo Three');
# second group, using the group reference
$bar1 = Gtk2::RadioButton->new (undef, 'Bar One');
$group = $bar1->get_group;
$bar2 = Gtk2::RadioButton->new ($group, 'Bar Two');
$bar3 = Gtk2::RadioButton->new ($group, 'Bar Three');
# move bar3 from the bar group to the foo group.
$bar->set_group ($foo->get_group);
# iterate over the widgets in the group
$group = $foo1->get_group;
foreach my $r (@$group) {
$r->set_sensitive ($whatever);
}
look at that. clean. organized. main character energy fr fr π₯
πΈ DESCRIPTION πΈ
so a single radio button on its own? lowkey does the same basic job as a Gtk2::CheckButton, which makes sense because its position in the object hierarchy reflects that (more on that in a sec). it's only when you group a bunch of radio buttons together that they level up into a whole different UI component in their own right. the way that group transforms them? obsessed. π
every radio button is a member of some group of radio buttons. and here's the tea: when one gets selected, all the other radio buttons in the same group get deselected. that's the whole point. a Gtk2::RadioButton is one way to let the user choose from many options β Gtk2::OptionMenu and Gtk2::ComboBox (added in gtk+ 2.4) are the alternatives if you wanna switch it up.
each constructor can take either a group, or a widget from that group, wherever the group is wanted β that's an enhancement over the C API, we love an upgrade β¨. still, the _from_widget forms are provided for completeness, so they're there if you want them.
π¦ HIERARCHY π¦
the family tree, and yes we're respecting our elders:
Glib::Object
+----Glib::InitiallyUnowned
+----Gtk2::Object
+----Gtk2::Widget
+----Gtk2::Container
+----Gtk2::Bin
+----Gtk2::Button
+----Gtk2::ToggleButton
+----Gtk2::CheckButton
+----Gtk2::RadioButton
every ancestor up there matters, bestie. don't skip your lineage π
π§ INTERFACES π§
Glib::Object::_Unregistered::AtkImplementorIfaceGtk2::BuildableGtk2::Activatable
π METHODS π
π widget = Gtk2::RadioButton->new ($member_or_listref=undef, $label=undef)
$member_or_listref(scalar) β a reference to a radiobutton group, or aGtk2::RadioButtonthat belongs to that group.$label(string)
creates a radio button, periodt. if you pass $label, it gets interpreted as a mnemonic. and if $member_or_listref is undef? congrats, the radio button gets created in a brand new group. fresh start energy π
π widget = Gtk2::RadioButton->new_from_widget ($group, $label=undef)
$group(Gtk2::RadioButton or undef)$label(string)
π widget = Gtk2::RadioButton->new_with_label ($member_or_listref=undef, $label=undef)
$member_or_listref(scalar) β a reference to a radiobutton group, or aGtk2::RadioButtonthat belongs to that group.$label(string)
creates a radio button with a plain text label, and this one will not be interpreted as a mnemonic. what you type is what you get, no tricks π
π widget = Gtk2::RadioButton->new_with_label_from_widget ($group, $label=undef)
$group(Gtk2::RadioButton or undef)$label(string)
π widget = Gtk2::RadioButton->new_with_mnemonic ($member_or_listref=undef, $label=undef)
$member_or_listref(scalar) β a reference to a radiobutton group, or aGtk2::RadioButtonthat belongs to that group.$label(string)
creates a radio button with a mnemonic β and heads up, this one is literally just an alias for new. same thing, different name, iykyk.
π widget = Gtk2::RadioButton->new_with_mnemonic_from_widget ($group, $label=undef)
$group(Gtk2::RadioButton or undef)$label(string)
π arrayref = $radio_button->get_group
returns a reference to the radio group that $radio_button belongs to. important part bestie: the group is a reference to an array of widget references, and that array is not magical β meaning it will not update itself automatically if the group changes. so call get_group every single time you want to use the group. don't be lazy about it, it will not do the work for you π
π $radio_button->set_group ($member_or_listref)
$member_or_listref(scalar) β a reference to the group, or aGtk2::RadioButtonthat belongs to that group.
assigns $radio_button to a new group. moving day! πβ¨
π PROPERTIES π
'group'(Gtk2::RadioButton: defaultundef: writable / private / static-nick / static-blurb)- the radio button whose group this widget belongs to.
π₯ SIGNALS π₯
group-changed(Gtk2::RadioButton)
π SEE ALSO π
Gtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget, Gtk2::Container, Gtk2::Bin, Gtk2::Button, Gtk2::ToggleButton, Gtk2::CheckButton
π COPYRIGHT π
copyright (C) 2003-2011 by the gtk2-perl team. π
this software is licensed under the LGPL. see Gtk2 for the full notice.
and that's the whole page, bestie, you ate that πβ¨ this was perl v5.42.0, dated 2025-07-25, and it's Gtk2::RadioButton(3) signing off β go build something cute with your radio groups, ily π
π
π¦ 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