Skip to content

Python TUI framework with mouse support, modular widget system, customizable and rapid terminal markup language and more!

License

Notifications You must be signed in to change notification settings

Polyfish0/pytermgui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

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)

readme-example

images

examples/basic_menu.py:

basic_menu

examples/project_picker.py:

project_picker

teahaz menu picker:

menu_picker

teahaz file picker:

filepicker

About

Python TUI framework with mouse support, modular widget system, customizable and rapid terminal markup language and more!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 99.7%
  • Other 0.3%