Quickstart
Install tuiify and create your first terminal form from a typed Python function.
Create a terminal form from a typed Python function and return its submitted result.
Install tuiify
- Use Python 3.9 or later.
- Install the package:
pip install tuiifyCreate an interactive function
- Create a file named
greet.py. - Add a typed function and decorate it with
@interactive:
from tuiify import interactive
@interactive
def greet(name: str, excited: bool = False) -> str:
"""Create a greeting."""
suffix = "!" if excited else "."
return f"Hello, {name}{suffix}"
if __name__ == "__main__":
result = greet()
print(result)- Run the script:
python greet.pyA full-screen form opens with a text input for name and a checkbox for excited. Enter a name, then press Ctrl+S to submit.
After submitting Ada with excited selected, the app displays the result and the script prints:
Hello, Ada!Call the function directly
Pass arguments when you want the original Python function to run without opening the form:
from tuiify import interactive
@interactive
def greet(name: str, excited: bool = False) -> str:
suffix = "!" if excited else "."
return f"Hello, {name}{suffix}"
print(greet("Ada", excited=True))Expected output:
Hello, Ada!Continue with input types to choose controls for your function parameters.
Updated about 4 hours ago
Did this page help you?

