Skip to content

Commit 7779de1

Browse files
authored
Update code.py
1 parent 108f763 commit 7779de1

File tree

1 file changed

+12
-11
lines changed
  • GC9A01A_Demo_Code/Python_GC9A01A

1 file changed

+12
-11
lines changed

GC9A01A_Demo_Code/Python_GC9A01A/code.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# SPDX-License-Identifier: MIT
55

6-
'''Raspberry Pi Graphics example for the 240x240 Round TFT'''
6+
'''Raspberry Pi Graphics example for the Vertical Newxie TFT'''
77

88
import time
99
import digitalio
@@ -18,13 +18,14 @@
1818
dc_pin = digitalio.DigitalInOut(board.D25)
1919
reset_pin = digitalio.DigitalInOut(board.D27)
2020

21-
BAUDRATE = 24000000
21+
BAUDRATE=24000000
22+
2223

2324
spi = board.SPI()
2425

25-
disp = gc9a01a.GC9A01A(spi, rotation=180,
26-
width=135, height=240,
27-
x_offset=53, y_offset=40,
26+
disp = gc9a01a.GC9A01A(spi, rotation=0,
27+
width=240, height=240,
28+
x_offset=0, y_offset=0,
2829
cs=cs_pin,
2930
dc=dc_pin,
3031
rst=reset_pin,
@@ -37,22 +38,22 @@
3738
# -------TEXT AND SHAPES---------
3839
image1 = Image.new("RGB", (width, height))
3940
draw1 = ImageDraw.Draw(image1)
40-
draw1.rectangle((0, 0, width, height), fill=(0, 255, 0)) # Green background
41+
draw1.ellipse((0, 0, width, height), fill=(0, 255, 0)) # Green background
4142

42-
draw1.rectangle(
43+
draw1.ellipse(
4344
(BORDER, BORDER, width - BORDER - 1, height - BORDER - 1), fill=(170, 0, 136)
4445
)
4546
font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", FONTSIZE)
46-
text = "Hello\nWorld!"
47+
text = "Hello World!"
4748
(font_width, font_height) = font.getsize(text)
4849
draw1.text(
49-
(30, height // 2 - font_height // 2-12),
50+
(width // 2 - font_width // 2, height // 2 - font_height // 2),
5051
text,
5152
font=font,
5253
fill=(255, 255, 0),
5354
)
5455

55-
# ------BLINKA JPEG DISPLAY----------
56+
# ------ADABOT JPEG DISPLAY----------
5657
image2 = Image.open("blinka_round.jpg")
5758
image_ratio = image2.width / image2.height
5859
screen_ratio = width / height
@@ -66,5 +67,5 @@
6667
while True:
6768
disp.image(image1) # show text
6869
time.sleep(2)
69-
disp.image(image2) # show blinka
70+
disp.image(image2) # show adabot
7071
time.sleep(2)

0 commit comments

Comments
 (0)