Metadata-Version: 2.1
Name: textual-terminal
Version: 0.3.0
Summary: A terminal emulator widget for Textual.
Home-page: https://github.com/mitosch/textual-terminal
License: LGPL-3.0-or-later
Keywords: textual,textual terminal,textual terminal emulator,textual subprocess
Author: Mischa Schindowski
Author-email: mschindowski@gmail.com
Requires-Python: >=3.7,<4.0
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows :: Windows 10
Classifier: Operating System :: Microsoft :: Windows :: Windows 11
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: pyte (>=0.8.1,<0.9.0)
Requires-Dist: textual (>=0.8.0)
Project-URL: Repository, https://github.com/mitosch/textual-terminal
Description-Content-Type: text/markdown

# Textual: Terminal

A terminal widget for [Textual](https://github.com/Textualize/textual) using
[Pyte](https://github.com/selectel/pyte) as a linux terminal emulator.

<details><summary>Textual application example with two terminal widgets:</summary>

![textual_terminal_example](https://user-images.githubusercontent.com/922559/214794889-4d376da1-6aa9-4576-a01d-0beee2536e41.png)

</details>

## Usage

```python
from textual_terminal import Terminal

class TerminalApp(App):
    def compose(self) -> ComposeResult:
        yield Terminal(command="htop", id="terminal_htop")
        yield Terminal(command="bash", id="terminal_bash")

    def on_ready(self) -> None:
        terminal_htop: Terminal = self.query_one("#terminal_htop")
        terminal_htop.start()

        terminal_bash: Terminal = self.query_one("#terminal_bash")
        terminal_bash.start()
```

## Installation

```bash
pip install textual-terminal
```

## Features

* Colored output
* Automatic resize to widget dimensions
* Simple key handling (navigation, function keys)
* Simple mouse tracking (click, scroll)

## Options

### `default_colors`

By default, textual-terminal uses the colors defined by the system (not the
Textual colors). To use the Textual background and foreground colors for
"default" ANSI colors, set the option `default_colors` to `textual`:

```python
Terminal(command="htop", default_colors="textual")
```

Note: This only applies to ANSI colors without an explicit setting, e.g. if the
background is set to "red" by an application, it will stay red and the option
will not have any effect.

## References

This library is based on the
[Textual pyte example](https://github.com/selectel/pyte/blob/master/examples/terminal_emulator.py)
by [David Brochart](https://github.com/davidbrochart).

