Update docs/introduction.md

Co-authored-by: darrenburns <darrenburns@users.noreply.github.com>
This commit is contained in:
Will McGugan
2022-08-05 09:16:37 +01:00
committed by GitHub
parent 331cbc650e
commit fa61ca0f64

View File

@@ -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: