LabFrame(3pm)
π LabFrame β the labeled frame, bestie π
okay so this is Tk::LabFrame, a page from the User Contributed Perl Documentation (3pm section, iykyk), and it's literally just a Frame that finally got its life together and got a label. iconic behavior honestly π
β¨ NAME β¨
Tk::LabFrame β labeled frame. that's it, that's the whole vibe π
πΈ SYNOPSIS πΈ
use Tk::LabFrame;
$f = $parent->LabFrame(?-label=>text, -labelside=>where, ...?);
π¦ DESCRIPTION π¦
so LabFrame is exactly like Frame, no cap β same energy, same everything β except it ALSO lets you add a label to the frame. that's the whole glow-up. bestie said "what if frame but with a little name tag" and honestly? slay π
π WIDGET-OPTIONS π
LabFrame supports the same options as the Frame widget. everything Frame can do, it does. periodt.
but wait, there's more β¨ β here are the extra options LabFrame brings to the group chat:
-font => fontβ picks the label's font. give it a whole new look, main character energy fr fr π-foreground => colorβ sets the label's foreground color. make it pop πΈ-label => textβ the actual text of the label that gets placed with the Frame. this is the whole point bestie π-labelside => whereβ tells you where the label goes.wherecan be one ofleft,right,top,bottomoracrosstop.- the first four (
left,right,top,bottom) do exactly what you'd expect β label goes to the left, right, above, or below the frame respectively. no plot twist. - but
acrosstop?? that one's the drama queen π it creates a grooved frame around the central frame and puts the label near the northwest corner, so it looks like the label is "overwriting" the groove. it's giving β¨overlapβ¨ and we're obsessed.
- the first four (
-labelvariable => scalar_refβ a reference to a variable, used as an alternative to-label. if the value of that variable changes, the widget updates itself automatically to reflect the change. no manual refreshing, it just knows π used like-textvariable.
π§ ADVERTISED SUBWIDGETS π§
peep "Subwidget" in Tk::mega if you wanna know how to use advertised widgets, bestie π«Ά
borderβ Frame used to display the borderframeβ Frame used to create new LabFrame childrenlabelβ Label used for displaying text
π EXAMPLE π
run this little test program to see it in action, fr fr:
use strict;
use Tk;
require Tk::LabFrame;
require Tk::LabEntry;
my $test = 'Test this';
my $mw = Tk::MainWindow->new;
my $f = $mw->LabFrame(-label => "This is a label",
-labelside => "acrosstop");
$f->LabEntry(-label => "Testing", -textvariable => \$test)->pack;
$f->pack;
Tk::MainLoop;
go on, run it. watch the acrosstop groove do its little thing. ate π
π BUGS π
perhaps LabFrame should be subsumed within the generic pTk labeled widget mechanism. that's the note. that's the whole note. ngl it's giving "we could've just merged these" π
π AUTHOR π
Rajappa Iyer rsi@earthling.net
this code is derived from LabFrame.tcl and LabWidg.tcl in the Tix4.0 distribution by Ioi Lam. the code may be redistributed under the same terms as Perl.
and that's the whole page bestie!! now go label a frame and be iconic πβ¨π
this was brought to you by perl v5.40.1, dated 2025-04-13 β LabFrame(3pm), out. mwah π«Άπ
π¦ where this page comes from
- debian trixie: perl-tk 1:804.036+dfsg1-5
- ubuntu questing: perl-tk 1:804.036+dfsg1-5
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms