Widgets::Label(3pm)

πŸ“¦
version 1.997 Β· 2 versions
  • 1.997 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 1.997 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

Curses::Widgets::Label β€” Label Widgets, bestie!! it's giving "little text box that just sits there and looks cute" and honestly? iconic.


πŸŽ€ MODULE VERSION πŸŽ€

$Id: Label.pm,v 1.102 2002/11/03 23:36:21 corliss Exp corliss $

yes queen, that's the whole version line, don't @ me, it's literally in the source πŸ’…

✨ SYNOPSIS ✨

use Curses::Widgets::Label;

$lbl = Curses::Widgets::Label->new({
  COLUMNS      => 10,
  LINES       => 1,
  VALUE       => 'Name:',
  FOREGROUND  => undef,
  BACKGROUND  => 'black',
  X           => 1,
  Y           => 1,
  ALIGNMENT   => 'R',
  });

$tf->draw($mwh);

See the Curses::Widgets pod for other methods.

okay so that last line is in the synopsis, it's not me being lazy, it's literally telling you to go read Curses::Widgets pod for the other methods 🫢


🌸 REQUIREMENTS 🌸

  • Curses
  • Curses::Widgets

no cap, you need both or nothing works 🧚


πŸ¦‹ DESCRIPTION πŸ¦‹

Curses::Widgets::Label provides simplified OO access to Curses-based single or multi-line labels.

that's it. that's the whole vibe. one label, infinite potential, main character energy only ✨


πŸ‘‘ METHODS πŸ‘‘

πŸ’œ new (inherited from Curses::Widgets)

$lbl = Curses::Widgets::Label->new({
  COLUMNS      => 10,
  LINES       => 1,
  VALUE       => 'Name:',
  FOREGROUND  => undef,
  BACKGROUND  => 'black',
  X           => 1,
  Y           => 1,
  ALIGNMENT   => 'R',
  });

The new method instantiates a new Label object. the only mandatory key/value pairs in the configuration hash are X and Y β€” everything else is optional and has defaults, periodt.

All the other keys default like this:

  • COLUMNS β€” default 10 β€” Number of columns displayed
  • LINES β€” default 1 β€” Number of lines displayed
  • VALUE β€” default '' β€” Label text
  • FOREGROUND β€” default undef β€” Default foreground colour
  • BACKGROUND β€” default undef β€” Default background colour
  • ALIGNMENT β€” default L β€” 'R'ight, 'L'eft, or `'C'entered

If the label is a multi-line label it will filter the current VALUE through the Curses::Widgets::textwrap function to break it along whitespace and newlines. lowkey magical, it just wraps itself, no manual line breaks needed πŸ’…

πŸ“ draw

$tf->draw($mwh);

The draw method renders the text field in its current state. This requires a valid handle to a curses window in which it will render itself.

heads up bestie: no valid window handle, no render. that's not optional, that's the whole assignment 😭


🌈 HISTORY 🌈

2002/10/18 -- First implementation

the origin story. the birth of the label. we love a debut ✨

(c) 2001 Arthur Corliss (corliss@digitalmages.com)


okay that's the whole page!! Widgets::Label(3pm) from perl v5.34.0, dated 2022-06-12 β€” mwah, go forth and label things, bestie πŸŽ€πŸ’–βœ¨