Skip to content

Commit ddb47d1

Browse files
authored
Merge pull request adafruit#805 from kattni/oled-watch-update
Update to use .width
2 parents 2d47b5b + c7ae68d commit ddb47d1

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

CircuitPython_OLED_Watch/CircuitPython_OLED_Watch.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
import adafruit_ds3231
66
from adafruit_display_text import label
77

8+
9+
font = terminalio.FONT
10+
11+
812
displayio.release_displays()
913

1014
i2c = board.I2C()
@@ -28,8 +32,6 @@
2832
# Comment out the above four lines again after setting the time!
2933

3034

31-
font = terminalio.FONT
32-
3335
while True:
3436
current = rtc.datetime
3537

@@ -50,15 +52,15 @@
5052
text = label.Label(font, text=text_display)
5153

5254
(_, _, width, _) = clock.bounding_box
53-
clock.x = 128 // 2 - width // 2
55+
clock.x = oled.width // 2 - width // 2
5456
clock.y = 5
5557

5658
(_, _, width, _) = date.bounding_box
57-
date.x = 128 // 2 - width // 2
59+
date.x = oled.width // 2 - width // 2
5860
date.y = 15
5961

6062
(_, _, width, _) = text.bounding_box
61-
text.x = 128 // 2 - width // 2
63+
text.x = oled.width // 2 - width // 2
6264
text.y = 25
6365

6466
watch_group = displayio.Group()

0 commit comments

Comments
 (0)