Name | mono-term JSON |
Version |
0.36.0
JSON |
| download |
home_page | None |
Summary | Embeddable terminal emulator |
upload_time | 2024-07-21 09:15:55 |
maintainer | None |
docs_url | None |
author | Billy |
requires_python | <4.0,>=3.10 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
## Mono: Embeddable Terminal Emulator
> [!IMPORTANT]
> See [PR #4](https://github.com/tomlin7/mono/pull/4) on new output parser under development
**Mono** is a terminal emulator that can be embedded in tkinter applications. See [examples](./examples) to see mono in action. The codebase was extracted from the [**Biscuit project**](https://github.com/billyeatcookies/biscuit) and published as an embeddable widget library.
- Supports handling **multiple instances** of terminals of different shells running simultaneously.
- Comes as a standalone terminal widget & a **tabbed widget** as well, for handling different terminal instances.
- **Custom terminals** can be made; most shells available on the platform are detected by mono.
- Themes are fully customizable by the user.

```py
import tkinter as tk
from mono import Terminals, get_available_shells, get_shell_from_name
root = tk.Tk()
root.geometry('800x300')
terminals = Terminals(root)
terminals.add_default_terminal()
terminals.pack(fill='both', expand=True)
# A menu for opening terminals
mbtn = tk.Menubutton(root, text="Open Terminal", relief=tk.RAISED)
menu = tk.Menu(mbtn)
for i in get_available_shells():
menu.add_command(label=i, command=lambda i=i: terminals.open_shell(get_shell_from_name(i)))
mbtn.config(menu=menu)
mbtn.pack()
root.mainloop()
```
`Terminals` is a container for multiple terminals. It provides a simple interface for managing multiple terminals in a tabbed interface.
All the shells detected for the platform can be accessed with `get_available_shells()`. The `get_shell_from_name()` function returns a shell object from the name of the shell.
### Custom Terminals
Following example demonstrates how to create a NodeJS standalone terminal with mono.
```py
# NOTE: Due to the missing additional ANSI handling, NodeJS shell
# might not work as expected. The issue is being fixed, see pr #4
import tkinter as tk
from mono import Terminal
class NodeJS(Terminal):
name = "NodeJS"
shell = "node"
root = tk.Tk()
terminal = NodeJS(root)
terminal.start_service()
terminal.pack(fill='both', expand=True)
root.mainloop()
```
### Custom Theming
Following example implements a custom light theme for mono terminals
```py
import tkinter as tk
from mono import Terminals, Theme
class Light(Theme):
bg = "#FFFFFF"
fg = "#000000"
abg = "#CCCCCC"
afg = "#000000"
border = "#DDDDDD"
# further overriding the __init__ will give more control over specific widgets:
#
# def __init__(self, master=None, **kwargs):
# super().__init__(master, **kwargs)
# self.tabs = (self.bg, 'red')
root = tk.Tk()
root.geometry("800x300")
terminals = Terminals(root, theme=Light())
terminals.pack(fill="both", expand=True)
terminals.open_python() # open a python console
terminals.open_another_terminal() # open another instance of active
root.mainloop()
```
Further...
- Shells can be run standalone or in a tabbed interface, see [examples/standalone](./examples/standalone.py).
- Custom terminals can be made by subclassing the `Terminal` class, see [examples/customshell](./examples/customshell.py).
- Custom themes can be passed to the `Terminal`, `Terminals` classes, see [examples/customtheme](./examples/customtheme.py).
- High resolution text rendering can be enabled for windows, see [examples/highres](./examples/highres.py).
For more examples, see the [examples](./examples) directory.
Raw data
{
"_id": null,
"home_page": null,
"name": "mono-term",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": null,
"author": "Billy",
"author_email": "billydevbusiness@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ae/1d/6f16cae95d05c9673b14611835a7ae495de156fde9d04d0932a2beb2a626/mono_term-0.36.0.tar.gz",
"platform": null,
"description": "## Mono: Embeddable Terminal Emulator\n\n> [!IMPORTANT]\n> See [PR #4](https://github.com/tomlin7/mono/pull/4) on new output parser under development\n\n**Mono** is a terminal emulator that can be embedded in tkinter applications. See [examples](./examples) to see mono in action. The codebase was extracted from the [**Biscuit project**](https://github.com/billyeatcookies/biscuit) and published as an embeddable widget library.\n\n- Supports handling **multiple instances** of terminals of different shells running simultaneously.\n- Comes as a standalone terminal widget & a **tabbed widget** as well, for handling different terminal instances.\n- **Custom terminals** can be made; most shells available on the platform are detected by mono.\n- Themes are fully customizable by the user.\n\n\n\n```py\nimport tkinter as tk\n\nfrom mono import Terminals, get_available_shells, get_shell_from_name\n\nroot = tk.Tk()\nroot.geometry('800x300')\n\nterminals = Terminals(root)\nterminals.add_default_terminal()\nterminals.pack(fill='both', expand=True)\n\n# A menu for opening terminals\nmbtn = tk.Menubutton(root, text=\"Open Terminal\", relief=tk.RAISED)\nmenu = tk.Menu(mbtn)\nfor i in get_available_shells():\n menu.add_command(label=i, command=lambda i=i: terminals.open_shell(get_shell_from_name(i)))\n\nmbtn.config(menu=menu)\nmbtn.pack()\nroot.mainloop()\n```\n\n`Terminals` is a container for multiple terminals. It provides a simple interface for managing multiple terminals in a tabbed interface.\n\nAll the shells detected for the platform can be accessed with `get_available_shells()`. The `get_shell_from_name()` function returns a shell object from the name of the shell.\n\n### Custom Terminals\n\nFollowing example demonstrates how to create a NodeJS standalone terminal with mono.\n\n```py\n# NOTE: Due to the missing additional ANSI handling, NodeJS shell\n# might not work as expected. The issue is being fixed, see pr #4\n\nimport tkinter as tk\nfrom mono import Terminal\n\nclass NodeJS(Terminal):\n name = \"NodeJS\"\n shell = \"node\"\n\nroot = tk.Tk()\nterminal = NodeJS(root)\nterminal.start_service()\nterminal.pack(fill='both', expand=True)\n\nroot.mainloop()\n```\n\n### Custom Theming\n\nFollowing example implements a custom light theme for mono terminals\n\n```py\nimport tkinter as tk\nfrom mono import Terminals, Theme\n\nclass Light(Theme):\n bg = \"#FFFFFF\"\n fg = \"#000000\"\n abg = \"#CCCCCC\"\n afg = \"#000000\"\n border = \"#DDDDDD\"\n\n # further overriding the __init__ will give more control over specific widgets:\n #\n # def __init__(self, master=None, **kwargs):\n # super().__init__(master, **kwargs)\n # self.tabs = (self.bg, 'red')\n\n\nroot = tk.Tk()\nroot.geometry(\"800x300\")\n\nterminals = Terminals(root, theme=Light())\nterminals.pack(fill=\"both\", expand=True)\n\nterminals.open_python() # open a python console\nterminals.open_another_terminal() # open another instance of active\n\nroot.mainloop()\n```\n\nFurther...\n\n- Shells can be run standalone or in a tabbed interface, see [examples/standalone](./examples/standalone.py).\n- Custom terminals can be made by subclassing the `Terminal` class, see [examples/customshell](./examples/customshell.py).\n- Custom themes can be passed to the `Terminal`, `Terminals` classes, see [examples/customtheme](./examples/customtheme.py).\n- High resolution text rendering can be enabled for windows, see [examples/highres](./examples/highres.py).\n\nFor more examples, see the [examples](./examples) directory.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Embeddable terminal emulator",
"version": "0.36.0",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "425511e8ceb1c23b79a9462c696c6e6555b5396f284255aadf52cb5d504d1cde",
"md5": "750d3190b1d33990621af5731145765a",
"sha256": "69834b427555533e11c39a3c67468a60b4d841eca6e9af5664584f2ecde6afe9"
},
"downloads": -1,
"filename": "mono_term-0.36.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "750d3190b1d33990621af5731145765a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 14570,
"upload_time": "2024-07-21T09:15:53",
"upload_time_iso_8601": "2024-07-21T09:15:53.093383Z",
"url": "https://files.pythonhosted.org/packages/42/55/11e8ceb1c23b79a9462c696c6e6555b5396f284255aadf52cb5d504d1cde/mono_term-0.36.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ae1d6f16cae95d05c9673b14611835a7ae495de156fde9d04d0932a2beb2a626",
"md5": "b185c4b20ad25e30fd0ed5979a0990b8",
"sha256": "4c135c42596c5080b141722d33ab2371569ea59c5a1d0571a0c1738243063e97"
},
"downloads": -1,
"filename": "mono_term-0.36.0.tar.gz",
"has_sig": false,
"md5_digest": "b185c4b20ad25e30fd0ed5979a0990b8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 10287,
"upload_time": "2024-07-21T09:15:55",
"upload_time_iso_8601": "2024-07-21T09:15:55.189022Z",
"url": "https://files.pythonhosted.org/packages/ae/1d/6f16cae95d05c9673b14611835a7ae495de156fde9d04d0932a2beb2a626/mono_term-0.36.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-21 09:15:55",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "mono-term"
}