# Windows Terminal Emulator
This project is a fully functional terminal emulator application for Windows.
## Features
- Local terminal emulation on Windows.
- Tabbed interface for managing multiple terminal sessions.
- Support for text-based UI applications like `VIM` and `htop` will work when ssh'd to a linux host.
- Customizable appearance and behavior.
## Screen Shots
<div align="center">
<hr><img src="https://github.com/scottpeterman/tkwinterm/raw/main/screenshots/win1.png" alt="Window with color" width="400px">
</div>
## Libraries Used
- `tkinter`: Standard GUI toolkit for Python used for the application interface.
- `pyte`: A simple VTXXX-compatible terminal emulator library used for interpreting escape sequences and managing the terminal state.
- `uuid`: For generating unique identifiers for terminal sessions.
- `threading`: For managing concurrent operations.
- `winpty`: A Windows software package providing an interface to the Windows pseudo terminal (WinPTY).
## Key Classes
- `App`: The main application class that initializes the GUI, manages terminal tabs, and handles user interactions.
- `Terminal`: A class representing a single terminal instance. It handles the rendering of the terminal screen, input events, and terminal resizing.
- `WinPtyHandler`: This class manages the interaction with the local Windows command line, encapsulating the functionality provided by WinPTY.
- `KeyHandler`: A utility class for interpreting keyboard input and sending it to the terminal.
## Methodology
The core of the terminal emulation is handled by `pyte`. Here's how it's integrated into our application:
1. **Terminal Output Handling**: When output from the command line is available, it is fed into `pyte`'s `ByteStream` object. `pyte` interprets this data, which includes processing escape sequences and maintaining an in-memory representation of the terminal's screen.
2. **Screen Rendering**: The `Terminal` class translates `pyte`'s in-memory screen into text and colors in the `tkinter.Text` widget. This involves converting the screen's character cells into styled text that can be displayed in the GUI.
3. **Input Handling**: User input from the keyboard is captured by the `KeyHandler` and sent to the `WinPtyHandler`. For remote connections, input would be sent via an SSH channel.
4. **Terminal Resizing**: When the terminal window is resized, both `pyte` and `WinPtyHandler` are informed of the new dimensions. `pyte` uses this information to update its screen model, and `WinPtyHandler` adjusts the pseudo terminal accordingly.
5. **Session Management**: Each terminal tab has a unique session, identified by a UUID. This allows for multiple independent terminal sessions within the application.
## Getting Started
To run the application, ensure you have Python installed and the required packages available. Clone the repository, and run the main script:
```bash
python main_winpty.py
```
## Contributions
Contributions to the project are welcome. Please fork the repository and submit a pull request with your enhancements.
## License
This project is licensed under the GPLv3 License - see the LICENSE file for details.
## Build
```python
# Create a wheel
pip install wheel setuptools
python setup.py sdist bdist_wheel
```
Raw data
{
"_id": null,
"home_page": "https://github.com/scottpeterman/tkwinterm",
"name": "tkwinterm",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "",
"keywords": "",
"author": "Scott Peterman",
"author_email": "scottpeterman@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/61/ed/f35c23ff8c426464cbd19d22e7fb09243f37f6061f9c8bf307dccfa574ed/tkwinterm-0.2.2.tar.gz",
"platform": null,
"description": "\r\n# Windows Terminal Emulator\r\n\r\nThis project is a fully functional terminal emulator application for Windows.\r\n\r\n## Features\r\n\r\n- Local terminal emulation on Windows.\r\n- Tabbed interface for managing multiple terminal sessions.\r\n- Support for text-based UI applications like `VIM` and `htop` will work when ssh'd to a linux host.\r\n- Customizable appearance and behavior.\r\n\r\n## Screen Shots\r\n<div align=\"center\">\r\n <hr><img src=\"https://github.com/scottpeterman/tkwinterm/raw/main/screenshots/win1.png\" alt=\"Window with color\" width=\"400px\">\r\n</div>\r\n\r\n## Libraries Used\r\n\r\n- `tkinter`: Standard GUI toolkit for Python used for the application interface.\r\n- `pyte`: A simple VTXXX-compatible terminal emulator library used for interpreting escape sequences and managing the terminal state.\r\n- `uuid`: For generating unique identifiers for terminal sessions.\r\n- `threading`: For managing concurrent operations.\r\n- `winpty`: A Windows software package providing an interface to the Windows pseudo terminal (WinPTY).\r\n\r\n## Key Classes\r\n\r\n- `App`: The main application class that initializes the GUI, manages terminal tabs, and handles user interactions.\r\n- `Terminal`: A class representing a single terminal instance. It handles the rendering of the terminal screen, input events, and terminal resizing.\r\n- `WinPtyHandler`: This class manages the interaction with the local Windows command line, encapsulating the functionality provided by WinPTY.\r\n- `KeyHandler`: A utility class for interpreting keyboard input and sending it to the terminal.\r\n\r\n## Methodology\r\n\r\nThe core of the terminal emulation is handled by `pyte`. Here's how it's integrated into our application:\r\n\r\n1. **Terminal Output Handling**: When output from the command line is available, it is fed into `pyte`'s `ByteStream` object. `pyte` interprets this data, which includes processing escape sequences and maintaining an in-memory representation of the terminal's screen.\r\n\r\n2. **Screen Rendering**: The `Terminal` class translates `pyte`'s in-memory screen into text and colors in the `tkinter.Text` widget. This involves converting the screen's character cells into styled text that can be displayed in the GUI.\r\n\r\n3. **Input Handling**: User input from the keyboard is captured by the `KeyHandler` and sent to the `WinPtyHandler`. For remote connections, input would be sent via an SSH channel.\r\n\r\n4. **Terminal Resizing**: When the terminal window is resized, both `pyte` and `WinPtyHandler` are informed of the new dimensions. `pyte` uses this information to update its screen model, and `WinPtyHandler` adjusts the pseudo terminal accordingly.\r\n\r\n5. **Session Management**: Each terminal tab has a unique session, identified by a UUID. This allows for multiple independent terminal sessions within the application.\r\n\r\n## Getting Started\r\n\r\nTo run the application, ensure you have Python installed and the required packages available. Clone the repository, and run the main script:\r\n\r\n```bash\r\npython main_winpty.py\r\n```\r\n\r\n## Contributions\r\n\r\nContributions to the project are welcome. Please fork the repository and submit a pull request with your enhancements.\r\n\r\n## License\r\n\r\nThis project is licensed under the GPLv3 License - see the LICENSE file for details.\r\n\r\n## Build\r\n```python\r\n# Create a wheel\r\npip install wheel setuptools\r\npython setup.py sdist bdist_wheel\r\n```\r\n\r\n\r\n",
"bugtrack_url": null,
"license": "",
"summary": "A fully functional terminal/console widget for Windows, built on Python, Tkinnter and Pyte",
"version": "0.2.2",
"project_urls": {
"Homepage": "https://github.com/scottpeterman/tkwinterm"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "be0b133552178447d440e3724c80d8c7529b0a4fc2ad5b01c365f6933d1c1620",
"md5": "71bfbabcd80866a79949693a1f13f915",
"sha256": "1745aa360f7dfd81c6d659b6f42dc459eb2aef509e64d2a0e0702b6f322272e4"
},
"downloads": -1,
"filename": "tkwinterm-0.2.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "71bfbabcd80866a79949693a1f13f915",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 25197,
"upload_time": "2024-02-05T16:11:02",
"upload_time_iso_8601": "2024-02-05T16:11:02.967541Z",
"url": "https://files.pythonhosted.org/packages/be/0b/133552178447d440e3724c80d8c7529b0a4fc2ad5b01c365f6933d1c1620/tkwinterm-0.2.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "61edf35c23ff8c426464cbd19d22e7fb09243f37f6061f9c8bf307dccfa574ed",
"md5": "8cb71efe8af849547dd70a1dbba2f3a2",
"sha256": "7fb3d913f268f3b59cc81644af42cf63ae3b73fcf52d7b108a0712b0118f0162"
},
"downloads": -1,
"filename": "tkwinterm-0.2.2.tar.gz",
"has_sig": false,
"md5_digest": "8cb71efe8af849547dd70a1dbba2f3a2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 25217,
"upload_time": "2024-02-05T16:11:04",
"upload_time_iso_8601": "2024-02-05T16:11:04.096652Z",
"url": "https://files.pythonhosted.org/packages/61/ed/f35c23ff8c426464cbd19d22e7fb09243f37f6061f9c8bf307dccfa574ed/tkwinterm-0.2.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-05 16:11:04",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "scottpeterman",
"github_project": "tkwinterm",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "pyte",
"specs": [
[
"==",
"0.8.2"
]
]
},
{
"name": "pywinpty",
"specs": [
[
"==",
"2.0.12"
]
]
},
{
"name": "sv-ttk",
"specs": [
[
"==",
"2.6.0"
]
]
},
{
"name": "wcwidth",
"specs": [
[
"==",
"0.2.13"
]
]
}
],
"lcname": "tkwinterm"
}