A simple library for creating different interactive menus
Project description
ASCII-Menus
ASCII_Menus is a simple library for creating different interactive menus
🚀 Features
- Simple and legible menus: Menus with options in cell format, title and displayed through the terminal.
- Custom size menu: Customizable size based on the number of options required, both in rows and columns.
- Custom size options: Customize the number of characters per option.
- Support for multiple pages of options
- Simple Scroll-Bar system
- Two interaction modes: Dynamic <--> Static.
- With Cursor
🛠 Installation
$ pip install ASCII-Menus
📖 Quick Start
Generate basic menu and show it
from ASCII_Menus import Menu
test_menu = Menu("test_menu", 3, 4, 5,
[
"test", ":", "menu",
"test", ":", "menu",
"test", ":", "menu",
"test", ":", "menu",
])
test_menu.menu_crafter()
+-------------------------+
| test_menu |
|-------------------------|
| |
| > test : menu |
| |
| test : menu |
| |
| test : menu |
| |
| test : menu |
+-------------------------+
Move cursor
...
test_menu.change_coordinate_cursor("s")
test_menu.menu_crafter()
+-------------------------+
| test_menu |
|-------------------------|
| |
| test : menu |
| |
| > test : menu |
| |
| test : menu |
| |
| test : menu |
+-------------------------+
Select option
...
input_user = input()
if input_user.lower() == "q":
test_menu.select_option()
Returns a tuple containing the cursor coordinates and the name option string.
([0, 1, 0], "test")
🌎 Real-World Examples
A short application example
from ASCII_Menus import Menu
import readchar
# Create your menu
TEST_MENU = Menu("test_menu", 3, 4, 5,
[
"test", ":", "menu",
"test", ":", "menu",
"test", ":", "menu",
"test", ":", "menu",
])
SELECT_KEY = "q"
TEST_OPTION = "test"
def options_test():
pass
def main():
while True:
input_user = readchar.readchar()
select_option = ""
# If you select the option
if input_user.lower() == SELECT_KEY:
select_option = TEST_MENU.select_option()[1]
# Ejecute function associated with the menu
if select_option == TEST_OPTION:
options_test()
# Show menu and update cursor coordinates.
TEST_MENU.menu_crafter()
TEST_MENU.change_coordinate_cursor(input_user)
if __name__ == "__main__":
main()
📄 License
This project is licensed under the MIT License.
📬 Contact
For any inquiries, reach out to me via:
- GitHub: Noxatr4
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
ascii_menus-0.1.0.tar.gz
(9.9 kB
view details)
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