Skip to content

Commit 2a9ed1e

Browse files
authored
fix for clock.py display date-time overlapping (#190)
1 parent 6195adf commit 2a9ed1e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

examples/clock.py

100755100644
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ def main():
3636
now = datetime.datetime.now()
3737
today_date = now.strftime("%d %b %y")
3838

39-
margin = 4
39+
margin = 5
4040

4141
cx = 30
42-
cy = min(device.height, 64) / 2
42+
cy = min(device.height, 60) / 2
4343

4444
left = cx - cy
4545
right = cx + cy
@@ -58,8 +58,9 @@ def main():
5858
draw.line((cx, cy, cx + mins[0], cy + mins[1]), fill="white")
5959
draw.line((cx, cy, cx + secs[0], cy + secs[1]), fill="red")
6060
draw.ellipse((cx - 2, cy - 2, cx + 2, cy + 2), fill="white", outline="white")
61-
draw.text((2 * (cx + margin), cy - 8), today_date, fill="yellow")
62-
draw.text((2 * (cx + margin), cy), today_time, fill="yellow")
61+
text_x = 2 * (cx + margin)
62+
draw.text((text_x, cy - 10), today_date, fill="yellow")
63+
draw.text((text_x, cy + 2), today_time, fill="yellow")
6364

6465
time.sleep(0.1)
6566

0 commit comments

Comments
 (0)