Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mitosch/textual-terminal
A terminal emulator widget for Textual.
https://github.com/mitosch/textual-terminal
Last synced: 3 months ago
JSON representation
A terminal emulator widget for Textual.
- Host: GitHub
- URL: https://github.com/mitosch/textual-terminal
- Owner: mitosch
- License: lgpl-3.0
- Created: 2023-01-26T08:29:11.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-02T21:10:21.000Z (about 1 year ago)
- Last Synced: 2024-05-23T07:02:56.312Z (9 months ago)
- Language: Python
- Size: 46.9 KB
- Stars: 79
- Watchers: 3
- Forks: 3
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-textualize-projects - Terminal - A terminal emulator widget for Textual. (Community / Third Party Applications)
README
# Textual: Terminal
A terminal widget for [Textual](https://github.com/Textualize/textual) using
[Pyte](https://github.com/selectel/pyte) as a linux terminal emulator.Textual application example with two terminal widgets:
![textual_terminal](https://user-images.githubusercontent.com/922559/215332972-79db9e52-7688-4353-9fc1-11ccdd2ec36f.png)
## Usage
```python
from textual_terminal import Terminalclass 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).