A terminal-based user interface application built with Textual, demonstrating a menu system, log data visualization, and various UI components.
Article & Video coming soon...
- Interactive menu navigation with keyboard controls
- Log data visualization with sortable columns
- Component showcase demonstrating various Textual widgets
- Color-coded log levels (INFO, WARN, ERROR)
- Responsive terminal UI with custom styling
- Python 3.9 or higher
This project uses Poetry for dependency management:
# Install poetry if you haven't already
pip install poetry
# Install dependencies
poetry install
Run the application:
poetry run python -m textual_tutorial.app
The application features three main screens:
-
Main Menu
- Use ↑/↓ arrows to navigate
- Press Enter to select an option
- Options include:
- Component Showcase
- Log Viewer
- Quit
-
Component Showcase
- Demonstrates various Textual widgets and interactions
- Features:
- Button variants (Success, Warning, Error)
- Text input with live feedback
- Toggle switch
- Animated progress bar
- Press
ESC
to return to menu
-
Log Viewer
- Displays log data in a sortable table
- Keyboard shortcuts:
ESC
: Return to menuT
: Sort by timestampL
: Sort by log levelM
: Sort by messageU
: Sort by user ID
- Interactive features:
- Click column headers to sort
- Color-coded log levels
- Row selection
textual_tutorial/
├── app.py # Main application entry point
├── components/
│ └── menu.py # Menu widget implementation
├── screens/
│ ├── log_screen.py # Log viewer screen
│ └── showcase_screen.py # Component showcase screen
├── styles.tcss # Textual CSS styling
└── logs/
└── demo_log.csv # Sample log data
This project is built with:
- Textual for the TUI framework
- Poetry for dependency management
- Type hints throughout the codebase
- Reactive programming patterns for UI state management
- MenuWidget: Custom widget for navigation with keyboard controls
- LogScreen: Data visualization with sorting capabilities
- ShowcaseScreen: Interactive demonstration of Textual widgets
- Styling: Custom TCSS (Textual CSS) for consistent visual design