headless-kivy-pi


Nameheadless-kivy-pi JSON
Version 0.8.0 PyPI version JSON
download
home_pagehttps://github.com/sassanh/headless-kivy-pi/
SummaryHeadless renderer for Kivy framework on Raspberry Pi
upload_time2024-06-25 17:08:46
maintainerNone
docs_urlNone
authorSassan Haradji
requires_python<4.0,>=3.11
licenseApache-2.0
keywords kivy raspberry-pi headless display
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Kivy Headless Renderer for Raspberry Pi

This project uses the Kivy framework to create a headless renderer
for a Raspberry Pi. The renderer is specifically designed for and tested with the
ST7789 SPI display, but it should work with other SPI displays as well. The code
utilizes the Adafruit RGB Display library to communicate with the display. The
renderer is optimized to not update the LCD if nothing has changed in the frame.

## 📋 Requirements

- Raspberry Pi 4 or 5
- SPI Display (tested with ST7789 module)

## 📦 Installation

You can install it using this handle: headless-kivy-pi@git+<https://github.com/ubopod/headless-kivy-pi.git>

```sh
pip install headless-kivy-pi
```

To work on a non-RPi environment, run this:

```sh
# pip:
pip install headless-kivy-pi[dev]
# poetry:
poetry --group dev headless-kivy-pi
```

## 🛠 Usage

1. Call setup_headless() before inheriting the `HeadlessWidget` class for the root
   widget of your application, and provide the optional parameters as needed. For
   example (these are all default values, you only need to provide the ones you want
   to change):

   ```python
   setup_headless(
       min_fps=1,
       max_fps=30,
       width=240,
       height=240,
       baudrate=60000000,
       is_debug_mode=False,
       display_class=ST7789,
       double_buffering=True,
       synchronous_clock=True,
       automatic_fps=True,
       clear_at_exit=True,
   )
   ```

1. Inherit the `HeadlessWidget` class for the root widget of your Kivy application.
   For example:

   ```python
   class FboFloatLayout(FloatLayout, HeadlessWidget):
       pass
   ```

1. Run the Kivy app as you normally would.

Checkout [Ubo App](https://github.com/ubopod/ubo-app) to see a sample implementation.

### ⚙️ Parameters

These parameters can be set to control the behavior of headless kivy pi:

#### `min_fps`

Minimum frames per second for when the Kivy application is idle.

#### `max_fps`

Maximum frames per second for the Kivy application.

#### `width`

The width of the display in pixels.

#### `height`

The height of the display in pixels.

#### `baudrate`

The baud rate for the display connection.

#### `is_debug_mode`

If set to True, the application will print debug information, including FPS.

#### `display_class`

The display class to use (default is ST7789).

#### `double_buffering`

Is set to `True`, it will let Kivy generate the next frame while sending the last
frame to the display.

#### `synchronous_clock`

If set to `True`, Kivy will wait for the LCD before rendering next frames. This will
cause Headless to skip frames if they are rendered before the LCD has finished displaying
the previous frames. If set to False, frames will be rendered asynchronously, letting
Kivy render frames regardless of display being able to catch up or not at the expense
of possible frame skipping.

#### `automatic_fps`

If set to `True`, it will monitor the hash of the screen data, if this hash changes,
it will increase the fps to the maximum and if the hash doesn't change for a while,
it will drop the fps to the minimum.

#### `clear_at_exit`

If set to `True`, it will clear the screen before exiting.

## 🤝 Contributing

You need to have [Poetry](https://python-poetry.org/) installed on your machine.

After having poetry, to install the required dependencies, run the following command
in the root directory of the project:

```sh
poetry install
```

## ⚠️ Important Note

This project has only been tested with the ST7789 SPI display module. Other display
modules might not be compatible or may require changing the parameters or even modifications
to the code.

## 🔒 License

This project is released under the Apache-2.0 License. See the [LICENSE](./LICENSE)
file for more details.


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/sassanh/headless-kivy-pi/",
    "name": "headless-kivy-pi",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.11",
    "maintainer_email": null,
    "keywords": "kivy, raspberry-pi, headless, display",
    "author": "Sassan Haradji",
    "author_email": "sassanh@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/fa/3a/6c132ee1754563e7c3c7219d51c08ea18d42daf84e09392072f9c1a941e8/headless_kivy_pi-0.8.0.tar.gz",
    "platform": null,
    "description": "# Kivy Headless Renderer for Raspberry Pi\n\nThis project uses the Kivy framework to create a headless renderer\nfor a Raspberry Pi. The renderer is specifically designed for and tested with the\nST7789 SPI display, but it should work with other SPI displays as well. The code\nutilizes the Adafruit RGB Display library to communicate with the display. The\nrenderer is optimized to not update the LCD if nothing has changed in the frame.\n\n## \ud83d\udccb Requirements\n\n- Raspberry Pi 4 or 5\n- SPI Display (tested with ST7789 module)\n\n## \ud83d\udce6 Installation\n\nYou can install it using this handle: headless-kivy-pi@git+<https://github.com/ubopod/headless-kivy-pi.git>\n\n```sh\npip install headless-kivy-pi\n```\n\nTo work on a non-RPi environment, run this:\n\n```sh\n# pip:\npip install headless-kivy-pi[dev]\n# poetry:\npoetry --group dev headless-kivy-pi\n```\n\n## \ud83d\udee0 Usage\n\n1. Call setup_headless() before inheriting the `HeadlessWidget` class for the root\n   widget of your application, and provide the optional parameters as needed. For\n   example (these are all default values, you only need to provide the ones you want\n   to change):\n\n   ```python\n   setup_headless(\n       min_fps=1,\n       max_fps=30,\n       width=240,\n       height=240,\n       baudrate=60000000,\n       is_debug_mode=False,\n       display_class=ST7789,\n       double_buffering=True,\n       synchronous_clock=True,\n       automatic_fps=True,\n       clear_at_exit=True,\n   )\n   ```\n\n1. Inherit the `HeadlessWidget` class for the root widget of your Kivy application.\n   For example:\n\n   ```python\n   class FboFloatLayout(FloatLayout, HeadlessWidget):\n       pass\n   ```\n\n1. Run the Kivy app as you normally would.\n\nCheckout [Ubo App](https://github.com/ubopod/ubo-app) to see a sample implementation.\n\n### \u2699\ufe0f Parameters\n\nThese parameters can be set to control the behavior of headless kivy pi:\n\n#### `min_fps`\n\nMinimum frames per second for when the Kivy application is idle.\n\n#### `max_fps`\n\nMaximum frames per second for the Kivy application.\n\n#### `width`\n\nThe width of the display in pixels.\n\n#### `height`\n\nThe height of the display in pixels.\n\n#### `baudrate`\n\nThe baud rate for the display connection.\n\n#### `is_debug_mode`\n\nIf set to True, the application will print debug information, including FPS.\n\n#### `display_class`\n\nThe display class to use (default is ST7789).\n\n#### `double_buffering`\n\nIs set to `True`, it will let Kivy generate the next frame while sending the last\nframe to the display.\n\n#### `synchronous_clock`\n\nIf set to `True`, Kivy will wait for the LCD before rendering next frames. This will\ncause Headless to skip frames if they are rendered before the LCD has finished displaying\nthe previous frames. If set to False, frames will be rendered asynchronously, letting\nKivy render frames regardless of display being able to catch up or not at the expense\nof possible frame skipping.\n\n#### `automatic_fps`\n\nIf set to `True`, it will monitor the hash of the screen data, if this hash changes,\nit will increase the fps to the maximum and if the hash doesn't change for a while,\nit will drop the fps to the minimum.\n\n#### `clear_at_exit`\n\nIf set to `True`, it will clear the screen before exiting.\n\n## \ud83e\udd1d Contributing\n\nYou need to have [Poetry](https://python-poetry.org/) installed on your machine.\n\nAfter having poetry, to install the required dependencies, run the following command\nin the root directory of the project:\n\n```sh\npoetry install\n```\n\n## \u26a0\ufe0f Important Note\n\nThis project has only been tested with the ST7789 SPI display module. Other display\nmodules might not be compatible or may require changing the parameters or even modifications\nto the code.\n\n## \ud83d\udd12 License\n\nThis project is released under the Apache-2.0 License. See the [LICENSE](./LICENSE)\nfile for more details.\n\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Headless renderer for Kivy framework on Raspberry Pi",
    "version": "0.8.0",
    "project_urls": {
        "Homepage": "https://github.com/sassanh/headless-kivy-pi/",
        "Repository": "https://github.com/sassanh/headless-kivy-pi/"
    },
    "split_keywords": [
        "kivy",
        " raspberry-pi",
        " headless",
        " display"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "48c178797fddbb73a16d73b85a9d6678801904110e17a8fa9e125760c7afcdeb",
                "md5": "7f3ce1aae9fd5aec5b75f4ec73f7f899",
                "sha256": "5bae90db127539f9ac913f02f8a2f0573810722843d509bd01d0bb57729dbe2b"
            },
            "downloads": -1,
            "filename": "headless_kivy_pi-0.8.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7f3ce1aae9fd5aec5b75f4ec73f7f899",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.11",
            "size": 18484,
            "upload_time": "2024-06-25T17:08:45",
            "upload_time_iso_8601": "2024-06-25T17:08:45.446045Z",
            "url": "https://files.pythonhosted.org/packages/48/c1/78797fddbb73a16d73b85a9d6678801904110e17a8fa9e125760c7afcdeb/headless_kivy_pi-0.8.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fa3a6c132ee1754563e7c3c7219d51c08ea18d42daf84e09392072f9c1a941e8",
                "md5": "02cf718b3c447acad647b6115db98d36",
                "sha256": "effd86e6eba2cd339fc48ba47c7eefeaadec9700741651388057663a2ff9a65c"
            },
            "downloads": -1,
            "filename": "headless_kivy_pi-0.8.0.tar.gz",
            "has_sig": false,
            "md5_digest": "02cf718b3c447acad647b6115db98d36",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.11",
            "size": 16529,
            "upload_time": "2024-06-25T17:08:46",
            "upload_time_iso_8601": "2024-06-25T17:08:46.776969Z",
            "url": "https://files.pythonhosted.org/packages/fa/3a/6c132ee1754563e7c3c7219d51c08ea18d42daf84e09392072f9c1a941e8/headless_kivy_pi-0.8.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-25 17:08:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sassanh",
    "github_project": "headless-kivy-pi",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "headless-kivy-pi"
}
        
Elapsed time: 0.28011s