Skip to main content

A module for TUI Menu driven application

Project description

TUI-Menu

This is a Python Module for Menu driven TUI scripts

It helps developers to write menu-driven scripts (or apps) in a simple way.

Installation

You have two wayes to install and use this module:

  • Use pip to install it
pip install tui-menu
  • Copy the tui-menu/Menu.py to your project

Usage

An example of using this module.

from tui_menu.Menu import Menu

# Create main menu
main_menu = Menu()

# Creating sub-menu
sub_menu = Menu()

# Setting up the title and menu level
main_manu.title("My Application main menu")
main_menu.level(0)

sub_menu.title("My Application sub menu")
sub_menu.level(1)

sub_menu.add_item(key="1", name="running option 2", data=op_func2)

main_menu.add_item(key="1", name="running option 1", data=op_func1)
main_menu.add_item(key="2", name="sub menu 1", data=sub_menu)

# Create functions for menu operations
def op_func1():
    # do something

def op_func2():
    # do something

# running the application
main_menu.run()

You can create as many as you want of sub-menus, each sub menu is a Menu object.

Every Menu item can be a Menu object (sub-menu) or a Function which can be call and execute some operation.

The menu key is one letter key, you cannot use 'x' or 'r' which use for

  • 'x' - exit the script / app
  • 'r' - use in sub menu to return one level up

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

This Module is distributing under the GPLv3+ Licensing

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

tui_menu-0.1.7.tar.gz (17.2 kB view details)

Uploaded Source

File details

Details for the file tui_menu-0.1.7.tar.gz.

File metadata

  • Download URL: tui_menu-0.1.7.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for tui_menu-0.1.7.tar.gz
Algorithm Hash digest
SHA256 e2160bdd2f57481777cc9e1fda1096209e064b76c613fdc2ec50d7d2e96537c6
MD5 c1d20abe38bc13ce7bbba50c07dd71c5
BLAKE2b-256 28581e5cef1c2f56744e2d3f0053abf9b58130f9336acd23fcc0f6b311cd2730

See more details on using hashes here.

Supported by

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