Skip to content

Commit c7b9492

Browse files
committed
Examples: Add hello_world.py
1 parent fef67aa commit c7b9492

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Python library for [Inky pHAT](https://shop.pimoroni.com/products/inky-phat), [I
1818

1919
### Inky Impression
2020

21-
[Inky Impression](https://shop.pimoroni.com/?q=inky+impression) is our line of glorious 7 colour eInk displays, available in [4"](https://shop.pimoroni.com/products/inky-impression-4) (640 x 400 pixel) [5.7"](https://shop.pimoroni.com/products/inky-impression-5-7) (600 x 448 pixel) and [7.3"](https://shop.pimoroni.com/products/inky-impression-7-3) (800 x 480 pixel) flavours. They're packed with strong colours and perfect for displaying striking graphics or lots of data.
21+
[Inky Impression](https://shop.pimoroni.com/search?q=inky%20impression) is our line of glorious colour eInk displays, available in various sizes from the petite 4.0" up to the mighty 13.3". They're packed with strong colours and perfect for displaying striking graphics or lots of data.
2222

2323
## Installation
2424

examples/spectra6/hello_world.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# This basic example shows how to draw shapes and text on Inky Impression using PIL.
2+
3+
from font_fredoka_one import FredokaOne
4+
from PIL import Image, ImageDraw, ImageFont
5+
6+
from inky.auto import auto
7+
8+
inky_display = auto(ask_user=True, verbose=True)
9+
10+
# Create new PIL image with a white background
11+
image = Image.new("P", (inky_display.width, inky_display.height), inky_display.WHITE)
12+
draw = ImageDraw.Draw(image)
13+
14+
font = ImageFont.truetype(FredokaOne, 72)
15+
16+
# draw some shapes
17+
draw.rectangle((50, 50, 200, 200), fill=inky_display.YELLOW) # Rectangle
18+
draw.ellipse((150, 150, 300, 300), fill=inky_display.RED) # Circle (ellipse)
19+
draw.line((0, 0, 400, 400), fill=inky_display.BLUE, width=10) # Diagonal line
20+
21+
# draw some text
22+
draw.text((0, 0), "Hello, World!", inky_display.BLACK, font)
23+
24+
inky_display.set_image(image)
25+
inky_display.show()

0 commit comments

Comments
 (0)