simple and robust terminal user interface library for the command line.
Project description
pytermgui
A simple module to display UI in the terminal, as well as to read input.
For now, a good example of use would be teahaz-client, but documentation will be coming soon.
getting started
# version with comments & explanation: examples/readme_example.py
from pytermgui import Container,container_from_dict,getch
data = {
"ui__title": "Test data",
"key": "value",
"key2": "value2",
"ui__button": {
"id": "test-data_button",
"value": "publish!"
}
}
containers = container_from_dict(data,width=40)
c = containers[0]
c.select()
c.center()
print('\033[2J')
print(c)
# - this can be substituted for:
# from pytermgui.utils import basic_selection
# basic_selection(c)
# - but for anything more advanced than basic use
# you should define your own method.
while True:
key = getch()
if key == "ARROW_UP":
c.selected_index -= 1
elif key == "ARROW_DOWN":
c.selected_index += 1
elif key == "SIGTERM":
raise KeyboardInterrupt
c.select()
print(c)
images
examples/basic_menu.py:
examples/project_picker.py:
teahaz menu picker:
teahaz file picker:
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
pytermgui-0.0.9.tar.gz
(23.9 kB
view hashes)