File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -198,8 +198,8 @@ which let them call [actions](../guide/actions.md) in response to key presses.
198198A widget is only able to handle key presses if it or one of its descendants has [ focus] ( ../guide/input.md#input-focus ) .
199199
200200Widgets aren't focusable by default.
201- In order to allow a widget to be focused, we need to set ` can_focus=True ` when defining a widget subclass.
202- Let 's look at an example of defining a ` Counter ` widget which can be focused.
201+ To allow a widget to be focused, we need to set ` can_focus=True ` when defining a widget subclass.
202+ Here 's an example of a simple focusable widget:
203203
204204=== "counter01.py"
205205
@@ -223,9 +223,9 @@ Let's look at an example of defining a `Counter` widget which can be focused.
223223 ```
224224
225225
226- Our app contains three ` Counter ` widgets, which we can focus by clicking or using ++tab++ and ++shift+tab++.
226+ The app above contains three ` Counter ` widgets, which we can focus by clicking or using ++tab++ and ++shift+tab++.
227227
228- Now that our counter is focusable, let's make it interactive by adding some key bindings and actions to it .
228+ Now that our counter is focusable, let's add some keybindings to it to allow us to change the count using the keyboard .
229229To do this, we add a ` BINDINGS ` class variable to ` Counter ` , with bindings for ++up++ and ++down++.
230230These new bindings are linked to the ` change_count ` action, which updates the ` count ` reactive attribute.
231231
You can’t perform that action at this time.
0 commit comments