lots of docstrings

This commit is contained in:
Will McGugan
2022-08-25 09:08:35 +01:00
parent cc4427a4bd
commit b22436933a
27 changed files with 407 additions and 147 deletions

View File

@@ -20,7 +20,7 @@ Textual requires Python 3.7 or later. Textual runs on Linux, MacOS, Windows and
## Installation
You can install Textual via PyPi.
You can install Textual via PyPI.
If you plan on developing Textual apps, then you should install `textual[dev]`. The `[dev]` part installs a few extra dependencies for development.
@@ -34,7 +34,7 @@ If you only plan on _running_ Textual apps, then you can drop the `[dev]` part:
pip install textual
```
## Textual CLI app
## Textual CLI
If you installed the dev dependencies you have have access to the `textual` CLI command. There are a number of sub-commands which will aid you in building Textual apps.

View File

@@ -45,7 +45,7 @@ If you want to try the finished Stopwatch app and following along with the code
gh repo clone Textualize/textual
```
With the repository cloned, navigate to `/docs/examples/introduction` and run `stopwatch.py`.
With the repository cloned, navigate to `docs/examples/introduction` and run `stopwatch.py`.
```bash
cd textual/docs/examples/introduction
@@ -69,7 +69,7 @@ def repeat(text: str, count: int) -> str:
```
- Parameter types follow a colon. So `text: str` indicates that `text` requires a string and `count: int` means that `count` requires an integer.
- Return types follow `->`. So `-> str:` indicates that this method returns a string.
- Return types follow `->`. So `-> str:` indicates this method returns a string.
## The App class
@@ -335,7 +335,7 @@ If you run "stopwatch04.py" now you will be able to toggle between the two state
## Reactive attributes
A reoccurring theme in Textual is that you rarely need to explicitly update a widget. It is possible: you can call `refresh()` to display new data. However, Textual prefers to do this automatically via _reactive_ attributes.
A reoccurring theme in Textual is that you rarely need to explicitly update a widget. It is possible: you can call [`refresh()`][textual.widget.Widget.refresh] to display new data. However, Textual prefers to do this automatically via _reactive_ attributes.
You can declare a reactive attribute with `textual.reactive.Reactive`. Let's use this feature to create a timer that displays elapsed time and keeps it updated.

View File

@@ -0,0 +1,5 @@
A message pump is a class that processes messages.
It is a base class for the App, Screen, and Widgets.
::: textual.message_pump.MessagePump

1
docs/reference/timer.md Normal file
View File

@@ -0,0 +1 @@
::: textual.timer