Files
textual/docs/examples/guide/input/key02.py
2022-09-24 17:04:00 +01:00

24 lines
456 B
Python

from textual.app import App, ComposeResult
from textual.widgets import TextLog
from textual import events
class KeyLogger(TextLog):
def on_key(self, event: events.Key) -> None:
self.write(event)
class InputApp(App):
"""App to display key events."""
CSS_PATH = "input02.css"
def compose(self) -> ComposeResult:
yield KeyLogger()
yield KeyLogger()
if __name__ == "__main__":
app = InputApp()
app.run()