mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Update docs/introduction.md
Co-authored-by: darrenburns <darrenburns@users.noreply.github.com>
This commit is contained in:
@@ -130,7 +130,7 @@ This script imports App as before, but also the `Widget` class from `textual.wid
|
|||||||
|
|
||||||
Widgets support many of the same events as the Application itself, and can be thought of as mini-applications in their own right. The Clock widget responds to a Mount event which is the first event received when a widget is _mounted_ (added to the App). The code in `Clock.on_mount` sets `styles.content_align` to tuple of `("center", "middle")` which tells Textual to display the Widget's content aligned to the horizontal center, and in the middle vertically. If you resize the terminal, you should find the time remains in the center.
|
Widgets support many of the same events as the Application itself, and can be thought of as mini-applications in their own right. The Clock widget responds to a Mount event which is the first event received when a widget is _mounted_ (added to the App). The code in `Clock.on_mount` sets `styles.content_align` to tuple of `("center", "middle")` which tells Textual to display the Widget's content aligned to the horizontal center, and in the middle vertically. If you resize the terminal, you should find the time remains in the center.
|
||||||
|
|
||||||
The second line in `on_mount` calls `self.set_interval` which tells Textual to invoke the `self.refresh` method once a second.
|
The second line in `on_mount` calls `self.set_interval` which tells Textual to invoke the `self.refresh` method once per second.
|
||||||
|
|
||||||
When Textual refreshes a widget it calls it's `render` method:
|
When Textual refreshes a widget it calls it's `render` method:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user