py-vision-free
A text-mode UI toolkit for Python: windows, dialogs, menus, a status line and input
widgets in the terminal. Standard library only, Python 3.12 or newer, on Windows,
Linux and macOS.
Inspired by Borland Turbo Vision; used by rex for its terminal UI.
Install
pip install py-vision-free
The import name is py_vision_free.
A first program
from py_vision_free import Application, Command, Rect
from py_vision_free.platform import open_terminal
from py_vision_free.widgets import StaticText, StatusItem, StatusLine
from py_vision_free.window import Window
class Hello(Application):
def setup(self) -> None:
w, h = self.screen.width, self.screen.height
self.set_status_line(StatusLine(Rect(0, h - 1, w, h), [
StatusItem("~Alt-X~ Exit", "Alt+X", Command.QUIT),
]))
win = Window(Rect(10, 3, 50, 10), "Hello")
win.insert(StaticText(Rect(2, 1, 36, 4), "Hello, terminal!", role="window"))
self.desktop.insert(win)
Hello(open_terminal()).run()
Alt-X quits. The examples/ folder has hello.py, mmenu.py, palette.py and
tvdemo/, small programs in the shape of the demos that come with Turbo Vision.
Links