Skip to content

Commit

Permalink
Document class methods and dependency on PIL
Browse files Browse the repository at this point in the history
  • Loading branch information
Gadgetoid committed Feb 21, 2019
1 parent 2e272a8 commit 5f70ca8
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,38 @@ If you're using the wHAT you'll need to load the InkyWHAT class from the Inky li
from inky import InkyWHAT
inkywhat = InkyWHAT('red')
```

Once you've initialised Inky, there are only three methods you need to be concerned with:

#### Set Image

Set a PIL image, numpy array or list to Inky's internal buffer. The image dimensions should match the dimensiosn of the pHAT or wHAT you're using.

```python
inkyphat.set_image(image)
```

You should use `PIL` to create an image. `PIL` provides an `ImageDraw` module which allow you to draw text, lines and shapes over your image. See: https://pillow.readthedocs.io/en/stable/reference/ImageDraw.html

#### Set Border

Set the border colour of you pHAT or wHAT.

```python
inkyphat.set_border(colour)
```

`colour` should be one of `inky.RED`, `inky.YELLOW`, `inky.WHITE` or `inky.BLACK` with available colours depending on your diplay type.

#### Update The Display

Once you've prepared and set your image, and chosen a border colour, you can update your e-ink display with:

```python
inkyphat.show()
```


# Migrating

If you're migrating code from the `inkyphat` library you'll find that much of the drawing and image manipulation functions have been removed from Inky. These functions were always supplied by PIL, and the recommended approach is to use PIL to create and prepare your image before setting it to Inky with `set_image()`.

0 comments on commit 5f70ca8

Please sign in to comment.