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
Copy file name to clipboardExpand all lines: docs/guide/app.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# App Basics
2
2
3
-
In this chapter we will cover how to use Textual's App class to create an application. Just enough to get you up to speed. We will go in to more detail in the following chapters.
3
+
In this chapter we will cover how to use Textual's App class to create an application. Just enough to get you up to speed. We will go into more detail in the following chapters.
4
4
5
5
## The App class
6
6
@@ -30,7 +30,7 @@ If we run this app with `python simple02.py` you will see a blank terminal, some
When you call [App.run()][textual.app.App.run] Textual puts the terminal in to a special state called *application mode*. When in application mode the terminal will no longer echo what you type. Textual will take over responding to user input (keyboard and mouse) and will update the visible portion of the terminal (i.e. the *screen*).
33
+
When you call [App.run()][textual.app.App.run] Textual puts the terminal into a special state called *application mode*. When in application mode the terminal will no longer echo what you type. Textual will take over responding to user input (keyboard and mouse) and will update the visible portion of the terminal (i.e. the *screen*).
34
34
35
35
If you hit ++ctrl+q++ Textual will exit application mode and return you to the command prompt. Any content you had in the terminal prior to application mode will be restored.
36
36
@@ -42,7 +42,7 @@ If you hit ++ctrl+q++ Textual will exit application mode and return you to the c
42
42
43
43
!!! tip "Added in version 0.55.0"
44
44
45
-
You can also run apps in _inline_ mode, which will cause the app to appear beneath the prompt (and won't go in to application mode).
45
+
You can also run apps in _inline_ mode, which will cause the app to appear beneath the prompt (and won't go into application mode).
46
46
Inline apps are useful for tools that integrate closely with the typical workflow of a terminal.
47
47
48
48
To run an app in inline mode set the `inline` parameter to `True` when you call [App.run()][textual.app.App.run]. See [Style Inline Apps](../how-to/style-inline-apps.md) for how to apply additional styles to inline apps.
Copy file name to clipboardExpand all lines: docs/guide/devtools.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -62,7 +62,7 @@ textual run -c textual colors
62
62
## Serve
63
63
64
64
The devtools can also serve your application in a browser.
65
-
Effectively turning your terminal app in to a web application!
65
+
Effectively turning your terminal app into a web application!
66
66
67
67
The `serve` sub-command is similar to `run`. Here's how you can serve an app launched from a Python file:
68
68
@@ -144,7 +144,7 @@ textual console -v
144
144
145
145
### Decreasing verbosity
146
146
147
-
Log messages are classififed in to groups, and the `-x` flag can be used to **exclude** all message from a group. The groups are: `EVENT`, `DEBUG`, `INFO`, `WARNING`, `ERROR`, `PRINT`, `SYSTEM`, `LOGGING` and `WORKER`. The group a message belongs to is printed after its timestamp.
147
+
Log messages are classififed into groups, and the `-x` flag can be used to **exclude** all message from a group. The groups are: `EVENT`, `DEBUG`, `INFO`, `WARNING`, `ERROR`, `PRINT`, `SYSTEM`, `LOGGING` and `WORKER`. The group a message belongs to is printed after its timestamp.
148
148
149
149
Multiple groups may be excluded, for example to exclude everything except warning, errors, and `print` statements:
Copy file name to clipboardExpand all lines: docs/guide/events.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ This processing of messages is done within an asyncio Task which is started when
20
20
21
21
The FastAPI docs have an [excellent introduction](https://fastapi.tiangolo.com/async/) to Python async programming.
22
22
23
-
By way of an example, let's consider what happens if you were to type "Text" in to a `Input` widget. When you hit the ++t++ key, Textual creates a [key][textual.events.Key] event and sends it to the widget's message queue. Ditto for ++e++, ++x++, and ++t++.
23
+
By way of an example, let's consider what happens if you were to type "Text" into a `Input` widget. When you hit the ++t++ key, Textual creates a [key][textual.events.Key] event and sends it to the widget's message queue. Ditto for ++e++, ++x++, and ++t++.
24
24
25
25
The widget's task will pick the first message from the queue (a key event for the ++t++ key) and call the `on_key` method with the event as the first argument. In other words it will call `Input.on_key(event)`, which updates the display to show the new letter.
26
26
@@ -334,4 +334,4 @@ Let's look at an example which looks up word definitions from an [api](https://d
Note the highlighted line in the above code which calls `asyncio.create_task` to run a coroutine in the background. Without this you would find typing in to the text box to be unresponsive.
337
+
Note the highlighted line in the above code which calls `asyncio.create_task` to run a coroutine in the background. Without this you would find typing into the text box to be unresponsive.
The app splits the screen in to quarters, with a `RichLog` widget in each quarter. If you click any of the text logs, you should see that it is highlighted to show that the widget has focus. Key events will be sent to the focused widget only.
108
+
The app splits the screen into quarters, with a `RichLog` widget in each quarter. If you click any of the text logs, you should see that it is highlighted to show that the widget has focus. Key events will be sent to the focused widget only.
109
109
110
110
!!! tip
111
111
@@ -255,4 +255,4 @@ Most mice have a scroll wheel which you can use to scroll the window underneath
255
255
256
256
!!! information
257
257
258
-
Terminal emulators will typically convert trackpad gestures in to scroll events.
258
+
Terminal emulators will typically convert trackpad gestures into scroll events.
If you type in to the input now, the greeting will expand to fit the content. If you were to set `layout=False` on the reactive attribute, you should see that the box remains the same size when you type.
137
+
If you type into the input now, the greeting will expand to fit the content. If you were to set `layout=False` on the reactive attribute, you should see that the box remains the same size when you type.
138
138
139
139
## Validation
140
140
@@ -171,7 +171,7 @@ Watch method names begin with `watch_` followed by the name of the attribute, an
171
171
If the method accepts a single argument, it will be called with the new assigned value.
172
172
If the method accepts *two* positional arguments, it will be called with both the *old* value and the *new* value.
173
173
174
-
The following app will display any color you type in to the input. Try it with a valid color in Textual CSS. For example `"darkorchid"` or `"#52de44"`.
174
+
The following app will display any color you type into the input. Try it with a valid color in Textual CSS. For example `"darkorchid"` or `"#52de44"`.
175
175
176
176
=== "watch01.py"
177
177
@@ -311,15 +311,15 @@ Compute methods are the final superpower offered by the `reactive` descriptor. T
311
311
312
312
You could be forgiven in thinking this sounds a lot like Python's property decorator. The difference is that Textual will cache the value of compute methods, and update them when any other reactive attribute changes.
313
313
314
-
The following example uses a computed attribute. It displays three inputs for each color component (red, green, and blue). If you enter numbers in to these inputs, the background color of another widget changes.
314
+
The following example uses a computed attribute. It displays three inputs for each color component (red, green, and blue). If you enter numbers into these inputs, the background color of another widget changes.
Copy file name to clipboardExpand all lines: docs/guide/widgets.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -407,7 +407,7 @@ Textual will call this method as required to get content for every row of charac
407
407
--8<-- "docs/images/render_line.excalidraw.svg"
408
408
</div>
409
409
410
-
Let's look at an example before we go in to the details. The following Textual app implements a widget with the line API that renders a checkerboard pattern. This might form the basis of a chess / checkers game. Here's the code:
410
+
Let's look at an example before we go into the details. The following Textual app implements a widget with the line API that renders a checkerboard pattern. This might form the basis of a chess / checkers game. Here's the code:
Copy file name to clipboardExpand all lines: docs/tutorial.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -157,14 +157,14 @@ Here's what the above app defines:
157
157
--8<--"docs/examples/tutorial/stopwatch01.py"
158
158
```
159
159
160
-
The final three lines create an instance of the app and calls the [run()][textual.app.App.run] method which puts your terminal in to*application mode* and runs the app until you exit with ++ctrl+q++. This happens within a `__name__ == "__main__"` block so we could run the app with `python stopwatch01.py` or import it as part of a larger project.
160
+
The final three lines create an instance of the app and calls the [run()][textual.app.App.run] method which puts your terminal into*application mode* and runs the app until you exit with ++ctrl+q++. This happens within a `__name__ == "__main__"` block so we could run the app with `python stopwatch01.py` or import it as part of a larger project.
161
161
162
162
## Designing a UI with widgets
163
163
164
164
Textual has a large number of [builtin widgets](./widget_gallery.md).
165
165
For our app we will need new widgets, which we can create by extending and combining the builtin widgets.
166
166
167
-
Before we dive in to building widgets, let's first sketch a design for the app — so we know what we're aiming for.
167
+
Before we dive into building widgets, let's first sketch a design for the app — so we know what we're aiming for.
Copy file name to clipboardExpand all lines: docs/widgets/select.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ A Select widget is a compact control to allow the user to select between a numbe
9
9
-[ ] Container
10
10
11
11
12
-
The options in a select control may be passed in to the constructor or set later with [set_options][textual.widgets.Select.set_options].
12
+
The options in a select control may be passed into the constructor or set later with [set_options][textual.widgets.Select.set_options].
13
13
Options should be given as a sequence of tuples consisting of two values: the first is the string (or [Rich Renderable](https://rich.readthedocs.io/en/latest/protocol.html)) to display in the control and list of options, the second is the value of option.
14
14
15
15
The value of the currently selected option is stored in the `value` attribute of the widget, and the `value` attribute of the [Changed][textual.widgets.Select.Changed] message.
0 commit comments