You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Notice that Textual automatically focused the first widget, and that pressing ++tab++ and ++shift+tab++ will move focus between widgets.
222
227
223
-
Now that our counter is focusable, let's add some keybindings for incrementing and decrementing the counter.
224
-
To do this, we add a `BINDINGS` class variable to `Counter`, with bindings for incrementing and decrementing the counter using ++up++ and ++down++ respectively.
228
+
!!! note
229
+
230
+
You can also move focus to a widget by clicking on it.
231
+
232
+
Now that our counter is focusable, let's make it interactive by adding some key bindings and actions to it.
233
+
To do this, we add a `BINDINGS` class variable to `Counter`, with bindings for ++up++ and ++down++.
225
234
These new bindings are linked to the `change_count` action, which updates the `count` reactive attribute.
226
235
236
+
With our bindings in place, we can now change the count of the _currently focused counter_ using ++up++ and ++down++.
With our bindings in place, we can now change the count of the _currently focused counter_ using ++up++ and ++down++.
245
-
246
-
247
255
## Rich renderables
248
256
249
257
In previous examples we've set strings as content for Widgets. You can also use special objects called [renderables](https://rich.readthedocs.io/en/latest/protocol.html) for advanced visuals. You can use any renderable defined in [Rich](https://github.com/Textualize/rich) or third party libraries.
0 commit comments