prisma-tui


Nameprisma-tui JSON
Version 0.2.0 PyPI version JSON
download
home_pagehttps://github.com/diegobarmor/prisma-tui
SummaryA TUI framework based on the idea of "multi-layered transparency" composition.
upload_time2025-10-07 17:53:02
maintainerNone
docs_urlNone
authorDiegoBarMor
requires_python>=3.10
licenseMIT
keywords tui terminal user interface transparency layers layered curses
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PRISMA TUI
**Prisma TUI** (Python teRminal graphIcS with Multilayered trAnsparency) is a Python framework for building composable Terminal User Interfaces (TUIs). The `Terminal` class serves as a wrapper for terminal backends (e.g. curses) while providing a customizable application loop. Flexible layouts can be arranged by creating a hierarchy of `Section` class instances. Complex displays can be composed by

**Prisma** is built around the idea of *multilayered transparency*, which consists in overlaying different "layers" of text on top of each other and merging them together to compose more complex displays (think of stacking together images with transparency). This can be achieved by using the `Layer` class. **Prisma** also provides advanced color management, allowing to write and read multi-colored layers from its own custom **PAL** (*PALette*, JSON with color pair values) and **PRI** (*PRisma Image*, binary with the chars and the respective color pairs to form an image) formats.

<p align="center">
  <img src="logo.png" alt="Prisma TUI Logo" width="200"/><br>
  Rendition of <i>Prisma, the cat</i>.
</p>


<!-- ----------------------------------------------------------------------- -->
## QuickStart
### Run Demo
```
pip install prisma-tui
python3 demos/layouts.py
```

## Code Example
```python
import prismatui as pr

class MyTUI(pr.Terminal):
    def on_start(self):
        pr.init_pair(1, pr.COLOR_BLACK, pr.COLOR_CYAN)

    def on_update(self):
        self.draw_text('c', 'c', "Hello, pr!", pr.A_BOLD)
        self.draw_text("c+1", 'c', f"Key pressed: {self.key}", pr.A_BOLD)
        self.draw_text('b', 'l', "Press F1 to exit", pr.get_color_pair(1))

    def should_stop(self):
        return self.key == pr.KEY_F1

if __name__ == "__main__":
    MyTUI().run()
```


<!-- ----------------------------------------------------------------------- -->
## Core Concepts
- **Terminal:** Main application class; manages input, rendering, and lifecycle.
- **Section:** Container for layers and child sections, enabling complex layouts.
- **Layer:** 2D grid of [`prisma.Pixel`](prisma/pixel.py) objects. Layers can be combined by overwritting, blending or merging their attributes.
- **Palette:** Handles palette loading for easy setup of colors.


<!-- ----------------------------------------------------------------------- -->
## Demos
See the [`demos/`](demos/) folder for example applications:
- [`images.py`](demos/images.py): Image rendered from a pair of PRI and PAL files.
- [`layouts.py`](demos/layouts.py): Example of a complex layout built using different Section techniques.
- [`movement.py`](demos/movement.py): Example of an application in no-delay mode.
- [`keys.py`](demos/keys.py): Simple "hello world" example.


<!-- ----------------------------------------------------------------------- -->
## License
MIT License. See [LICENSE](LICENSE).


<!-- ----------------------------------------------------------------------- -->
# TODO
- Make `utilities/image_formatter.py` into an actual utility.


<!-- ----------------------------------------------------------------------- -->

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/diegobarmor/prisma-tui",
    "name": "prisma-tui",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "tui terminal user interface transparency layers layered curses",
    "author": "DiegoBarMor",
    "author_email": "diegobarmor42@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/2d/61/62fde34b335869ba9b99be9e2e150538f10a48756d59ba98b20a5ec4674f/prisma_tui-0.2.0.tar.gz",
    "platform": null,
    "description": "# PRISMA TUI\n**Prisma TUI** (Python teRminal graphIcS with Multilayered trAnsparency) is a Python framework for building composable Terminal User Interfaces (TUIs). The `Terminal` class serves as a wrapper for terminal backends (e.g. curses) while providing a customizable application loop. Flexible layouts can be arranged by creating a hierarchy of `Section` class instances. Complex displays can be composed by\n\n**Prisma** is built around the idea of *multilayered transparency*, which consists in overlaying different \"layers\" of text on top of each other and merging them together to compose more complex displays (think of stacking together images with transparency). This can be achieved by using the `Layer` class. **Prisma** also provides advanced color management, allowing to write and read multi-colored layers from its own custom **PAL** (*PALette*, JSON with color pair values) and **PRI** (*PRisma Image*, binary with the chars and the respective color pairs to form an image) formats.\n\n<p align=\"center\">\n  <img src=\"logo.png\" alt=\"Prisma TUI Logo\" width=\"200\"/><br>\n  Rendition of <i>Prisma, the cat</i>.\n</p>\n\n\n<!-- ----------------------------------------------------------------------- -->\n## QuickStart\n### Run Demo\n```\npip install prisma-tui\npython3 demos/layouts.py\n```\n\n## Code Example\n```python\nimport prismatui as pr\n\nclass MyTUI(pr.Terminal):\n    def on_start(self):\n        pr.init_pair(1, pr.COLOR_BLACK, pr.COLOR_CYAN)\n\n    def on_update(self):\n        self.draw_text('c', 'c', \"Hello, pr!\", pr.A_BOLD)\n        self.draw_text(\"c+1\", 'c', f\"Key pressed: {self.key}\", pr.A_BOLD)\n        self.draw_text('b', 'l', \"Press F1 to exit\", pr.get_color_pair(1))\n\n    def should_stop(self):\n        return self.key == pr.KEY_F1\n\nif __name__ == \"__main__\":\n    MyTUI().run()\n```\n\n\n<!-- ----------------------------------------------------------------------- -->\n## Core Concepts\n- **Terminal:** Main application class; manages input, rendering, and lifecycle.\n- **Section:** Container for layers and child sections, enabling complex layouts.\n- **Layer:** 2D grid of [`prisma.Pixel`](prisma/pixel.py) objects. Layers can be combined by overwritting, blending or merging their attributes.\n- **Palette:** Handles palette loading for easy setup of colors.\n\n\n<!-- ----------------------------------------------------------------------- -->\n## Demos\nSee the [`demos/`](demos/) folder for example applications:\n- [`images.py`](demos/images.py): Image rendered from a pair of PRI and PAL files.\n- [`layouts.py`](demos/layouts.py): Example of a complex layout built using different Section techniques.\n- [`movement.py`](demos/movement.py): Example of an application in no-delay mode.\n- [`keys.py`](demos/keys.py): Simple \"hello world\" example.\n\n\n<!-- ----------------------------------------------------------------------- -->\n## License\nMIT License. See [LICENSE](LICENSE).\n\n\n<!-- ----------------------------------------------------------------------- -->\n# TODO\n- Make `utilities/image_formatter.py` into an actual utility.\n\n\n<!-- ----------------------------------------------------------------------- -->\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A TUI framework based on the idea of \"multi-layered transparency\" composition.",
    "version": "0.2.0",
    "project_urls": {
        "Homepage": "https://github.com/diegobarmor/prisma-tui"
    },
    "split_keywords": [
        "tui",
        "terminal",
        "user",
        "interface",
        "transparency",
        "layers",
        "layered",
        "curses"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1d483ef982c1d8fe313f481b36eb99b15b7609712c8825a5617a8de0c7c79025",
                "md5": "4051feaea8892fbb55fa207cf81dcea6",
                "sha256": "e4a66e8d5908128d304076b1ef96160c3f3630ac6d2be0f9b22104695935c20a"
            },
            "downloads": -1,
            "filename": "prisma_tui-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4051feaea8892fbb55fa207cf81dcea6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 20644,
            "upload_time": "2025-10-07T17:53:00",
            "upload_time_iso_8601": "2025-10-07T17:53:00.201725Z",
            "url": "https://files.pythonhosted.org/packages/1d/48/3ef982c1d8fe313f481b36eb99b15b7609712c8825a5617a8de0c7c79025/prisma_tui-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "2d6162fde34b335869ba9b99be9e2e150538f10a48756d59ba98b20a5ec4674f",
                "md5": "b69cfef235a3cf05cb8580fe604974a5",
                "sha256": "6b13395cbc90abfcfc083948ca4e6c5ea47bd6a40b1aefc98e90e981f2fb3f45"
            },
            "downloads": -1,
            "filename": "prisma_tui-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "b69cfef235a3cf05cb8580fe604974a5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 16256,
            "upload_time": "2025-10-07T17:53:02",
            "upload_time_iso_8601": "2025-10-07T17:53:02.291003Z",
            "url": "https://files.pythonhosted.org/packages/2d/61/62fde34b335869ba9b99be9e2e150538f10a48756d59ba98b20a5ec4674f/prisma_tui-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-07 17:53:02",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "diegobarmor",
    "github_project": "prisma-tui",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "prisma-tui"
}
        
Elapsed time: 1.05437s