Simple curses utilities
Project description
CursesUtils
Functions
menu(stdscr, title, options)
Pulls up a select menu.
stdscr
: The screen to write to.title
: The title of the menu.options
: A collection of strings to choose from.
Returns the index of the selected item, or None if the user chooses to quit.
number_select(stdscr, title, num_range, start = None)
Pulls up a number selection menu.
stdscr
: The screen to write to.title
: The title of the selection.num_range
: A range object for valid numbers.start
: The starting selected number. Defaults tonum_range
's min value.
Returns the number selected, or None if the user chooses to quit.
set_key_codes(key_name, key_codes)
Sets a key's function by name.
key_name
: The key name to set.key_codes
: A collection of key codes (as returned bystdscr.getkey()
) to use.
Make sure to set keys before using them! Internally, CursesUtils uses the following keys:
menu_up
(for navigating UP through menus)menu_down
(for navigating DOWN through menus)menu_confirm
(for CONFIRMING on menus)menu_cancel
(for QUITTING on menus)
get_key_codes(key_name)
Gets a key's codes by name.
key_name
: The key name to get the codes of.
Returns the key codes of the given key, or None if it doesn't exist. See set_key_codes for more information.
get_next_key(stdscr)
Gets the next key and saves it.
stdscr
: The screen to write to.
get_current_key()
Gets the current pressed key.
is_pressed(key_name)
Checks if the given key is the current pressed key by name.
key_name
: The key name to check.
wrapper(func)
Wraps a function to set up and shut down, also wrapping using curses.wrapper
.
func
: The function to wrap.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for curses_utils-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92b5989ef9146cc2098e4719a2a765e2c19bf3cf3f7d03867211331b3ccd47c0 |
|
MD5 | 440681faeae753e8f3833bf8f3eb4d9e |
|
BLAKE2b-256 | ab02f0717818bf91bf566b2c1fe1119054ee6ddc8d3f106d75b0bfa8d50d847c |