Giter Site home page Giter Site logo

axelson / inky-python Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pimoroni/inky

0.0 2.0 0.0 11.74 MB

Combined library for V2/V3 Inky pHAT and Inky wHAT.

Home Page: https://shop.pimoroni.com/?q=inky

License: MIT License

Python 94.10% CSS 1.39% HTML 1.24% Makefile 2.43% Shell 0.84%

inky-python's Introduction

Inky

Build Status Coverage Status PyPi Package Python Versions

Python library for the Inky pHAT and Inky wHAT e-paper displays.

Inky pHAT

Inky pHAT is a 212x104 pixel e-paper display, available in red/black/white, yellow/black/white and black/white. It's great for nametags and displaying very low frequency information such as a daily calendar or weather overview.

Inky wHAT

Inky wHAT is a 400x300 pixel e-paper display available in red/black/white, yellow/black/white and black/white. It's got tons of resolution for detailed daily todo lists, multi-day weather forecasts, bus timetables and more.

Installation

The Python pip package is named inky, on the Raspberry Pi install with:

pip3 install inky[rpi,fonts]

This will install Inky along with dependencies for the Raspberry Pi, plus fonts used by the examples.

If you want to simulate Inky on your desktop, use:

pip3 install inky

You may need to use sudo pip3 or sudo pip depending on your environment and Python version.

Usage

The library should be run with python 3

Auto Setup

Inky can try to automatically detect your board and set up accordingly:

from inky.auto import auto
board = auto()

You can then get the colour and resolution from the board:

board.colour
board.resolution

Manual Setup

The Inky library contains modules for both the pHAT and wHAT, load the InkyPHAT one as follows:

from inky import InkyPHAT

You'll then need to pick your colour, one of 'red', 'yellow' or 'black' and instantiate the class:

inkyphat = InkyPHAT('red')

If you're using the wHAT you'll need to load the InkyWHAT class from the Inky library like so:

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 dimensions of the pHAT or wHAT you're using.

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.

inkyphat.set_border(colour)

colour should be one of inky.RED, inky.YELLOW, inky.WHITE or inky.BLACK with available colours depending on your display 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:

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().

inky-python's People

Contributors

gadgetoid avatar sandyjmacdonald avatar jimmadge avatar daviehh avatar jerbzz avatar helgibbons avatar peacedealer avatar jscd avatar joe-warren avatar jamesmconroy avatar unfinishedstuff avatar francesco-vannini avatar fisherthewol avatar davidskeck avatar danielssilva avatar danieldulaney avatar cluening avatar unsignedarduino avatar ajpoulter-soton avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.