Widget...essBar(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::ProgressBar β€” Progress Bar Widgets, bestie πŸ’…

(It's from the User Contributed Perl Documentation, manual page Widget...essBar(3pm), if you were wondering where we are rn 🫢)


✨ MODULE VERSION ✨

$Id: ProgressBar.pm,v 1.103 2002/11/03 23:40:04 corliss Exp corliss $

πŸ¦‹ SYNOPSIS πŸ¦‹

  use Curses::Widgets::ProgressBar;

  $progress = Curses::Widgets::ProgessBar->({
    CAPTION     => 'Progress',
    CAPTIONCOL  => 'yellow',
    LENGTH      => 10,
    VALUE       => 0,
    FOREGROUND  => undef,
    BACKGROUND  => 'black',
    BORDER      => 1,
    BORDERCOL   => undef,
    HORIZONTAL  => 1,
    X           => 1,
    Y           => 1,
    MIN         => 0,
    MAX         => 100,
    });

  $progress->draw($mwh);

  $progress->input(5);

  See the Curses::Widgets pod for other methods.
ok so yes, ProgessBar in that first line is spelled exactly like that in the original, no cap β€” copy it character for character, don't go "fixing" it, that's not the vibe πŸ™ˆ

🌸 REQUIREMENTS 🌸

  • Curses
  • Curses::Widgets

πŸ‘‘ DESCRIPTION πŸ‘‘

Curses::Widgets::ProgressBar gives you simplified OO access to a Curses-based progress bar. Every single object keeps track of its own state information β€” main character energy, it minds its own business πŸ’…

Heads up bestie: this widget is made for rendering, not for interactive input. It's giving "look at me, don't touch me" ✨

So how do you actually move the bar? Your app updates the value either by:

  1. Calling the input method β€” which adds the value you pass to the widget's current value, or
  2. Setting the value directly through the setField method.

That's it, that's the whole situation 🫢


πŸ’… METHODS πŸ’…

🌈 new (inherited from Curses::Widgets) 🌈

  $progress = Curses::Widgets::ProgressBar->({
    CAPTION     => 'Progress',
    CAPTIONCOL  => 'yellow',
    LENGTH      => 10,
    VALUE       => 0,
    FOREGROUND  => undef,
    BACKGROUND  => 'black',
    BORDER      => 1,
    BORDERCOL   => undef,
    HORIZONTAL  => 1,
    X           => 1,
    Y           => 1,
    MIN         => 0,
    MAX         => 100,
    });

new instantiates a brand new Progress Bar object, slay πŸŽ€ The only mandatory key/value pairs in the configuration hash are X and Y. Everything else? It's got a default, bestie:

Key         Default   Description
============================================================
CAPTION       undef   Caption superimposed on border
CAPTIONCOL    undef   Foreground colour for caption text
LENGTH           10   Number of columns for the bar
VALUE             0   Current value
FOREGROUND    undef   Default foreground colour
BACKGROUND    undef   Default blackground colour
BORDER            1   Display border around the set
BORDERCOL     undef   Foreground colour for border
HORIZONTAL        1   Horizontal orientation for bar
MIN               0   Low value for bar (0%)
MAX             100   High vlaue for bar (100%)

Setting the value changes the length of the bar, based on the bounds you set with MIN and MAX. And the CAPTION? It only gets rendered on the border of a horizontal progress bar. So if you flip it vertical and your caption vanishes β€” that's not a bug, that's just how she is πŸ’€


⭐ draw ⭐

  $progress->draw($mwh);

draw renders the progress bar in its current state. It needs a valid handle to a curses window to render itself into β€” give her a stage, she'll perform πŸ‘‘


πŸ“ input πŸ“

  $progress->input(5);

The argument gets added to the progress bar's current value. Math, but make it cute ✨


🧚 HISTORY 🧚

  • 2001/07/05 β€” First implementation

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


and that's a wrap, bestie 🫢 This little icon was rendered by perl v5.34.0, dated 2022-06-12, straight out of Widget...essBar(3pm). Stay hydrated, read your man pages, and go forth and draw progress bars πŸ’–βœ¨πŸŽ€