Skip to main content

Toolkit for quickly building nice looking command line interfaces

Project description

Py-clui

This is a Python toolkit for quickly building nice looking command line interfaces.

Build Status Code style: black

It also includes the following easy to use components:

  • Spinners
  • Gauge
  • Progress

Spinner(message, style=None)

Picture of a spinner

Parameters

  • message - The default status text to display while the spinner is spinning.
  • style - Array of graphical characters used to draw the spinner. By default, on Windows: ['|', '/', '-', ''], on other platforms: ['◜','◠','◝','◞','◡','◟']

Methods

  • run() - Show the spinner on the screen.
  • update_msg(message) - Update the status message that follows the spinner.

Example

from py_clui import Spinner

spinner = Spinner('Processing documents...')
spinner.run()

for x in range(100):
    spinner.update_msg('{0} Processed documents'.format(x))
    spinner.run()

Gauge(value, max_value, width, danger_zone, suffix=None)

Picture of a gauge

Draw a basic horizontal gauge to the screen.

Parameters

  • value
  • max_value
  • width
  • danger_zone
  • suffix

Example

from py_clui import gauge

total = 100
free = 30

used = total - free

print(gauge(used, total, 20, total * 0.8, 'Used memory'))

Progress(width=20)

Picture of a progress

Parameters

  • width - The width in characters of progress_bar

Methods

  • update(percent) - Return a progress bar width a this percente filled.

Example

from py_clui import Progress

progress = Progress(20)

print(progress.update(.5))

Motivation

  1. clui makes NodeJS even more sexy. Python needed something like it.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_clui-0.0.3.tar.gz (3.0 kB view details)

Uploaded Source

File details

Details for the file py_clui-0.0.3.tar.gz.

File metadata

  • Download URL: py_clui-0.0.3.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for py_clui-0.0.3.tar.gz
Algorithm Hash digest
SHA256 39ace0e73d1fea5a80b7d92d900e897f94442a16d28a2093603a9a68f87049ad
MD5 e7e5284c91acdcfd113b729b72eeb3f2
BLAKE2b-256 466e1cd1e6e7490f553e3ff0372bc1b6a925679e761b3b5ae46f252e24039d57

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page