Tickit::Console(3pm)
π Tickit::Console β the manual page, but make it cute
okay bestie, so this is Tickit::Console(3pm) from the User Contributed Perl Documentation β¨ and it is literally the blueprint for building full-screen console-style apps. like, terminal apps that look like a whole vibe. let's get into it π«Ά
β¨ NAME β¨
Tickit::Console β build full-screen console-style applications π
πΈ SYNOPSIS πΈ
my $console = Tickit::Console->new;
Tickit->new( root => $console )->run;
that's it. that's the whole flex. π
π¦ DESCRIPTION π¦
so a Tickit::Console instance is a subclass of Tickit::Widget::VBox, and its whole purpose in life is helping you build a full-screen console-style application. think: one or more scrollable text areas presented to the user, selectable as tabs on a ribbon (yes, a ribbon, iconic), plus a text entry area at the bottom of the screen for typing commands or whatever other data you need. π
and because it's a Tickit::Widget subclass, it can be dropped anywhere inside a widget tree β though ngl, normally you'd use it as the root widget for a Tickit instance. that's its main character moment. β¨
π CONSTRUCTOR π
new
$console = Tickit::Console->new( %args );
returns a fresh new instance of a Tickit::Console. it takes these named arguments:
on_line => CODEβ the callback to invoke when a line of text gets entered in the entry widget. it goes a little something like:
$on_line->( $active_tab, $text );
tab_class => STRINGβ optional, bestie. if you set it, it gives a class name (and it should be a subclass of Tickit::Console::Tab, okay?) that newly-added tabs get constructed with. this setting lets an application provide new methods in tabs to change behaviours. lowkey powerful.timestamp_format,datestamp_formatβ optional too. if you supply these, they get stored as default values to pass along to the tab constructor in theadd_tabmethod. π
π₯ METHODS π₯
add_tab
$tab = $console->add_tab( %args );
adds a new tab to the console, and returns a Tickit::Console::Tab object representing it. slay.
it takes these named arguments:
name => STRINGβ name for the tab.on_line => CODEβ optional. provides a different callback to invoke when a line of text is entered while this tab is active. invoked the same way as above. πmake_widget => CODEβ optional. gives a piece of code used to construct the actual Tickit::Widget used as this tab's child in the ribbon. aTickit::Widget::Scrollerto hold the tab's content gets passed in to this code, and it should construct some sort of widget tree with that inside it, then return it. this is your moment to apply a decorative frame, place the scroller in a split box or other layout along with other widgets, or do various other effects. go off. π
$tab_widget = $make_widget->( $scroller );
any other named arguments are passed to the tab's constructor. periodt.
active_tab_index
$index = $console->active_tab_index;
active_tab
$tab = $console->active_tab;
remove_tab
$console->remove_tab( $tab_or_index );
move_tab
$console->move_tab( $tab_or_index, $delta );
activate_tab
$console->activate_tab( $tab_or_index );
next_tab
$console->next_tab;
prev_tab
$console->prev_tab;
okay so all of these methods above? they're all passed through to the underlying Tickit::Widget::Tabbed object. so if you know that one, you already know these. iykyk. π
bind_key
$console->bind_key( $key, $code );
installs a callback to invoke if the given key is pressed β and heads up, it overwrites any previous callback for the same key. the code block is invoked as:
$code->( $console, $key );
if $code is missing or undef, any existing callback gets removed. clean. β¨
π AUTHOR π
Paul Evans <leonerd@leonerd.org.uk> β the icon, the legend, the moment. π
and that's a wrap bestie!! this page is from perl v5.36.0, dated 2024-01-01, and yes it really is Tickit::Console(3pm). go build something gorgeous with it. π¦π
β¨
π¦ where this page comes from
- debian trixie: libtickit-console-perl 0.12-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libtickit-console-perl 0.12-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtickit-console-perl 0.12-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtickit-console-perl 0.12-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