mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
docs: fix 'into' grammar
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# App Basics
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
## The App class
|
||||
|
||||
@@ -30,7 +30,7 @@ If we run this app with `python simple02.py` you will see a blank terminal, some
|
||||
```{.textual path="docs/examples/app/simple02.py"}
|
||||
```
|
||||
|
||||
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*).
|
||||
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*).
|
||||
|
||||
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.
|
||||
|
||||
@@ -42,7 +42,7 @@ If you hit ++ctrl+q++ Textual will exit application mode and return you to the c
|
||||
|
||||
!!! tip "Added in version 0.55.0"
|
||||
|
||||
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).
|
||||
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).
|
||||
Inline apps are useful for tools that integrate closely with the typical workflow of a terminal.
|
||||
|
||||
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.
|
||||
|
||||
@@ -62,7 +62,7 @@ textual run -c textual colors
|
||||
## Serve
|
||||
|
||||
The devtools can also serve your application in a browser.
|
||||
Effectively turning your terminal app in to a web application!
|
||||
Effectively turning your terminal app into a web application!
|
||||
|
||||
The `serve` sub-command is similar to `run`. Here's how you can serve an app launched from a Python file:
|
||||
|
||||
@@ -144,7 +144,7 @@ textual console -v
|
||||
|
||||
### Decreasing verbosity
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
Multiple groups may be excluded, for example to exclude everything except warning, errors, and `print` statements:
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ This processing of messages is done within an asyncio Task which is started when
|
||||
|
||||
The FastAPI docs have an [excellent introduction](https://fastapi.tiangolo.com/async/) to Python async programming.
|
||||
|
||||
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++.
|
||||
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++.
|
||||
|
||||
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.
|
||||
|
||||
@@ -334,4 +334,4 @@ Let's look at an example which looks up word definitions from an [api](https://d
|
||||
```{.textual path="docs/examples/events/dictionary.py"}
|
||||
```
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
@@ -105,7 +105,7 @@ The following example shows how focus works in practice.
|
||||
```{.textual path="docs/examples/guide/input/key03.py", press="H,e,l,l,o,tab,W,o,r,l,d,!"}
|
||||
```
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
!!! tip
|
||||
|
||||
@@ -255,4 +255,4 @@ Most mice have a scroll wheel which you can use to scroll the window underneath
|
||||
|
||||
!!! information
|
||||
|
||||
Terminal emulators will typically convert trackpad gestures in to scroll events.
|
||||
Terminal emulators will typically convert trackpad gestures into scroll events.
|
||||
|
||||
@@ -134,7 +134,7 @@ The following example modifies "refresh01.py" so that the greeting has an automa
|
||||
```{.textual path="docs/examples/guide/reactivity/refresh02.py" press="n,a,m,e"}
|
||||
```
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
## Validation
|
||||
|
||||
@@ -171,7 +171,7 @@ Watch method names begin with `watch_` followed by the name of the attribute, an
|
||||
If the method accepts a single argument, it will be called with the new assigned value.
|
||||
If the method accepts *two* positional arguments, it will be called with both the *old* value and the *new* value.
|
||||
|
||||
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"`.
|
||||
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"`.
|
||||
|
||||
=== "watch01.py"
|
||||
|
||||
@@ -311,7 +311,7 @@ Compute methods are the final superpower offered by the `reactive` descriptor. T
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
=== "computed01.py"
|
||||
|
||||
@@ -319,7 +319,7 @@ The following example uses a computed attribute. It displays three inputs for ea
|
||||
--8<-- "docs/examples/guide/reactivity/computed01.py"
|
||||
```
|
||||
|
||||
1. Combines color components in to a Color object.
|
||||
1. Combines color components into a Color object.
|
||||
2. The watch method is called when the _result_ of `compute_color` changes.
|
||||
|
||||
=== "computed01.tcss"
|
||||
|
||||
@@ -91,7 +91,7 @@ Knowing which test has failed will help you quickly track down where your code w
|
||||
## Simulating key presses
|
||||
|
||||
We've seen how the [`press`][textual.pilot.Pilot] method simulates keys.
|
||||
You can also supply multiple keys to simulate the user typing in to the app.
|
||||
You can also supply multiple keys to simulate the user typing into the app.
|
||||
Here's an example of simulating the user typing the word "hello".
|
||||
|
||||
```python
|
||||
|
||||
@@ -407,7 +407,7 @@ Textual will call this method as required to get content for every row of charac
|
||||
--8<-- "docs/images/render_line.excalidraw.svg"
|
||||
</div>
|
||||
|
||||
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:
|
||||
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:
|
||||
|
||||
=== "checker01.py"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user