Tickit...Static(3pm)
π Tickit::Widget::Static β bestie edition π
okay so this is Tickit::Widget::Static, straight out of the User Contributed Perl Documentation section of the manual (perl 3pm, iykyk). it's giving "put some words on the screen and let them vibe there forever" β¨
πΈ NAME πΈ
Tickit::Widget::Static β a widget displaying static text π
β¨ SYNOPSIS β¨
use Tickit;
use Tickit::Widget::Static;
my $hello = Tickit::Widget::Static->new(
text => "Hello, world",
align => "centre",
valign => "middle",
);
Tickit->new( root => $hello )->run;
π¦ DESCRIPTION π¦
so this class hands you a widget that displays, like, one single piece of static text. that's it. that's the whole job. π
the text can have more than one line, and you separate those lines with linefeed ("\n") characters. but bestie, listen β no other control sequences are allowed in the string. none. not even a little one. π
π STYLE π
the default style pen is what's used as the widget pen. periodt.
lowkey important: the widget pen is mutable, and if you change it, it redraws immediately β slay. BUT π any changes you made will be lost if the widget style gets changed. so don't get attached.
π§ CONSTRUCTOR π§
π new
$static = Tickit::Widget::Static->new( %args );
constructs a brand new Tickit::Widget::Static object, no cap.
it takes these named arguments, on top of whatever the base Tickit::Widget constructor already takes:
text => STRINGβ the text to display β¨align => FLOAT|STRINGβ optional. defaults to0.0if unspecified.valign => FLOAT|STRINGβ optional. defaults to0.0if unspecified.on_click => CODEβ optional. defaults toundefif unspecified.
for more details, peek the accessors below π
π ACCESSORS π
π text
$text = $static->text;
π set_text
$static->set_text( $text );
accessor for the text property β aka the actual text on display in the widget. it's giving "what you see is what's set". π«Ά
π align
π set_align
$align = $static->align;
$static->set_align( $align );
accessor for the horizontal alignment value. π
hand it a value in the range from 0.0 to 1.0 and it aligns the text display within the window. if the window is bigger than the width of the text, it gets aligned according to this value β with 0.0 on the left, 1.0 on the right, and every other value somewhere inbetween. iconic behaviour honestly.
see also Tickit::WidgetRole::Alignable. π¦
π AUTHOR π
Paul Evans <leonerd@leonerd.org.uk>
and that's the whole page, bestie!! π
this little writeup is perl v5.40.0, dated 2024-09-16, and it's the Tickit...Static(3pm) page β so like, go forth and align your static text, you absolute main character. mwah πβ¨
π¦ 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