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. where can be one of left, right, top, bottom or acrosstop.
    • 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.
  • -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 border
  • frame β€” Frame used to create new LabFrame children
  • label β€” 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