Metadata-Version: 2.4
Name: omnipython-pygraphics
Version: 0.2.1
Summary: Native graphics cmod for CPython (FrameBuffer, Area); import as pygraphics
License-Expression: MIT
Project-URL: Homepage, https://github.com/PyDevices/pygraphics
Project-URL: Issues, https://github.com/PyDevices/pygraphics/issues
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

![A red rounded rectangle, a green circle and the word Hello on black](docs/images/hello.png)

# pygraphics

pygraphics is the part of OmniPython that draws: shapes, text and images into
a framebuffer, with the same code on MicroPython-compatible boards,
CircuitPython-compatible boards and CPython.

```bash
pip install omnipython-pygraphics
```

```python
import omip
omip.install("pygraphics")
```

`omip` comes with OmniPython firmware. On other MicroPython firmware, run
`mip.install("github:PyDevices/omnipython/lib/omip.py")` once to put it on the board.

```python
import pygraphics
from pygraphics import FrameBuffer, RGB565

fb = FrameBuffer(bytearray(160 * 80 * 2), 160, 80, RGB565)
fb.fill(0x0000)
card = fb.round_rect(8, 8, 64, 40, 8, 0xF800, f=True)
dot = fb.circle(116, 28, 20, 0x07E0, f=True)
label = pygraphics.text16(fb, "Hello", 8, 56, 0xFFFF)
print("changed:", card + dot + label)
fb.save("hello.bmp")
```

```text
changed: Area(8, 8, 128, 64)
```

`hello.bmp` is the picture at the top of this page, shown at three times its
size.

[Docs](https://docs.omnipython.org/en/latest/pygraphics/) · [Examples](https://gallery.omnipython.org/pyscript/) · [Roadmap](ROADMAP.md)

OmniPython is made by [PyDevices](https://pydevices.com).
