Yet another simple console menu
Project description
Simple Menu
A lightweight console menu package for python applications. No frills, no fuss.
Installing
To install to your project, run the following command:
pip install simple_menu
How to Use
def main():
# Create a main menu
m = Menu(prompt="Main Menu")
m.items.append(FunctionItem(label="Item 1", function=lambda: print("Item 1")))
# Create a sub-menu
m2 = Menu(parent=m, prompt="Sub Menu 1")
m2.items.append(FunctionItem(label="Item 2", function=lambda: print("Item 2")))
# Add the sub-menu to the main menu
m.items.append(MenuItem(label="Sub Menu 1", menu=m2))
# Run the menu
m.run()
if __name__ == "__main__":
main()
The menu will run until the user chooses the Quit item, which will exit the application. When entering a sub-menu, an additional "go back" option is added which will return the user to the parent menu. The various prompts can be customized in the Menu() constructor.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters