Skip to content

Commit

Permalink
elaborate on naming convention of handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Sep 18, 2021
1 parent fa1b97f commit c14c0fc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -71,7 +71,7 @@ Beeper.run()

Here we can see a textual app with a single `on_key` method which will handle key events. Pressing any key will result in playing the terminal bell (generally an irritating beep). Hit Ctrl+C to exit.

Event handlers in Textual are defined by convention, not by inheritance (so you won't find an `on_key` method in the base class). Each event has a `name` attribute which for the key event is simply `"key"`. Textual will call the method named `on_<event.name>` if it exists.
Event handlers in Textual are defined by convention, not by inheritance (there's no base class with all the handlers defined). Each event has a `name` attribute which for the key event is simply `"key"`. Textual will call the method named `on_<event.name>` if it exists.

Let's look at a _slightly_ more interesting example:

Expand Down

0 comments on commit c14c0fc

Please sign in to comment.