textual/docs/examples/guide/input/key01.py
Dave Pearson f8bda04d90
Remove the on_space from key01 in the docs
While in this part of the docs we do want to keep the bell (see key02), it
was an error in the code that it included this event in key01. Removing it
from here because adding this bit of code for key02 is a key (no pun) part
of the docs.
2022-10-19 15:05:18 +01:00

18 lines
390 B
Python

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