Tickit...::VBox(3pm)
π Tickit::Widget::VBox β bestie edition π
okay so. Tickit::Widget::VBox is a Perl module (a 3pm manual page, if we're being official about it) and it does exactly one thing but it does it so well: it stacks your child widgets in a vertical column. top to bottom. that's the whole vibe. π
β¨ SYNOPSIS β¨
no thoughts, just code. here's the whole lewk:
use Tickit;
use Tickit::Widget::VBox;
use Tickit::Widget::Static;
my $vbox = Tickit::Widget::VBox->new;
foreach my $position (qw( top middle bottom )) {
$vbox->add(
Tickit::Widget::Static->new(
text => $position,
align => "centre",
valign => $position,
),
expand => 1
);
}
Tickit->new( root => $vbox )->run;
slay. three widgets, three vertical positions, one box. π«Ά
πΈ DESCRIPTION πΈ
so Tickit::Widget::VBox is a subclass of Tickit::Widget::LinearBox (iykyk β that's where the linear layout energy comes from), and it distributes its children in a vertical column. like, straight down. π
the sizing math is lowkey simple and highkey important:
- its width = the width of the widest child
- its height = the sum of the heights of all the children, plus the inter-child spacing
and here's a cute bonus: optionally, if you give it a non-zero spacing between child widgets and a style to draw in, it will draw a horizontal dividing line between each child. β¨ little separators. iconic.
π STYLE π
the default style pen is used as the widget pen. periodt. but also, these style pen prefixes get used:
line=> PEN β since version0.52. this is the pen used to render a dividing line between child widgets.
β οΈ okay important thing bestie: the widget pen is mutable, and changes to it will result in immediate redrawing. BUT β any changes you make will be lost if the widget style is changed. so like, don't get attached. π
and the style keys it uses:
spacing=> INT β the number of lines of spacing between children.line_style=> INT β since version0.52. if set, this is the style used to draw a dividing line between each child widget. it must be one of theLINE_*constants fromTickit::RenderBuffer. no random numbers, bestie, it will not pass the vibe check. π
π AUTHOR π
Paul Evans <leonerd@leonerd.org.uk> β the main character who wrote this. give him his flowers. πΉ
that's the whole page, fr fr. this manual page is from perl v5.40.0, dated 2024-09-16, and it lives under the name Tickit...::VBox(3pm) in the User Contributed Perl Documentation section. go stack some widgets, you got this. πβ¨π¦
π¦ where this page comes from
- ubuntu resolute: libtickit-widgets-perl 0.42-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtickit-widgets-perl 0.42-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms