tessl install tessl/pypi-textual@6.1.0Modern Text User Interface framework for building cross-platform terminal and web applications with Python
Agent Success
Agent success rate when using this tile
93%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.18x
Baseline
Agent success rate without this tile
79%
Build a terminal user interface application that monitors a configuration file for changes and displays the updated content in real-time.
Create a terminal application that:
q key to quit the applicationThe application should use asynchronous file monitoring and update the UI reactively when changes are detected.
@generates
from textual.app import App
class ConfigWatcherApp(App):
"""A TUI application that monitors a configuration file for changes."""
def __init__(self, file_path: str):
"""
Initialize the application with a file path to monitor.
Args:
file_path: Path to the configuration file to watch
"""
...
async def on_mount(self) -> None:
"""Set up the file monitor when the application mounts."""
...
def handle_file_change(self, path: str) -> None:
"""
Callback invoked when the monitored file changes.
Args:
path: Path to the file that changed
"""
...
def main(file_path: str) -> None:
"""
Entry point to run the application.
Args:
file_path: Path to the configuration file to monitor
"""
...Provides the TUI framework with file monitoring capabilities.
@satisfied-by