decreased width for clock 1 prof

This commit is contained in:
Justin 2023-09-20 15:18:32 +08:00 committed by GitHub
parent 6c164709fc
commit 33b4333b76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1229,11 +1229,11 @@ class StockTicker():
date_width, date_height = draw.textsize(date_t, font_2) date_width, date_height = draw.textsize(date_t, font_2)
wday_width, wday_height = draw.textsize(weekday_t, font_2) wday_width, wday_height = draw.textsize(weekday_t, font_2)
text_width, text_height = draw.textsize(time_t, font_1) text_width, text_height = draw.textsize(time_t, font_1)
total_width = text_width + 6 + max(wday_width, date_width) total_width = text_width + 5 + max(wday_width, date_width)
starting_coord = (128-total_width)/2 starting_coord = (128-total_width)/2
draw.text((starting_coord, 1), time_t, time_colors1[time_color2], font_1) draw.text((starting_coord, 1), time_t, time_colors1[time_color2], font_1)
draw.text((starting_coord + text_width + 6, 1), date_t, time_colors1[date_color2], font_2) draw.text((starting_coord + text_width + 5, 1), date_t, time_colors1[date_color2], font_2)
draw.text((starting_coord + text_width + 7, 8), weekday_t, time_colors1[weekday_color2], font_2) draw.text((starting_coord + text_width + 6, 8), weekday_t, time_colors1[weekday_color2], font_2)
#If time now is greater than 1 second of the previously updated image time, update image and reset updated image time to another second #If time now is greater than 1 second of the previously updated image time, update image and reset updated image time to another second
if time.time() >= the_time + 1: if time.time() >= the_time + 1:
the_time = time.time() the_time = time.time()
@ -1245,11 +1245,11 @@ class StockTicker():
date_width, date_height = draw.textsize(date_t, font_2) date_width, date_height = draw.textsize(date_t, font_2)
wday_width, wday_height = draw.textsize(weekday_t, font_2) wday_width, wday_height = draw.textsize(weekday_t, font_2)
text_width, text_height = draw.textsize(time_t, font_1) text_width, text_height = draw.textsize(time_t, font_1)
total_width = text_width + 6 + max(wday_width, date_width) total_width = text_width + 5 + max(wday_width, date_width)
starting_coord = (128-total_width)/2 starting_coord = (128-total_width)/2
draw.text((starting_coord, 1), time_t, time_colors1[time_color2], font_1) draw.text((starting_coord, 1), time_t, time_colors1[time_color2], font_1)
draw.text((starting_coord + text_width + 6, 1), date_t, time_colors1[date_color2], font_2) draw.text((starting_coord + text_width + 5, 1), date_t, time_colors1[date_color2], font_2)
draw.text((starting_coord + text_width + 7, 8), weekday_t, time_colors1[weekday_color2], font_2) draw.text((starting_coord + text_width + 6, 8), weekday_t, time_colors1[weekday_color2], font_2)
if time.time() - update_t1 > delay_t1: if time.time() - update_t1 > delay_t1:
update_t1 = time.time() update_t1 = time.time()
#Get the pause time right before image is done transitioning in #Get the pause time right before image is done transitioning in
@ -1459,11 +1459,11 @@ class StockTicker():
date_width_b, date_height_b = draw2.textsize(date_t_b, font_2_b) date_width_b, date_height_b = draw2.textsize(date_t_b, font_2_b)
wday_width_b, wday_height_b = draw2.textsize(weekday_t_b, font_2_b) wday_width_b, wday_height_b = draw2.textsize(weekday_t_b, font_2_b)
text_width_b, text_height_b = draw2.textsize(time_t_b, font_1_b) text_width_b, text_height_b = draw2.textsize(time_t_b, font_1_b)
total_width_b = text_width_b + 6 + max(wday_width_b, date_width_b) total_width_b = text_width_b + 5 + max(wday_width_b, date_width_b)
starting_coord_b = (128-total_width_b)/2 starting_coord_b = (128-total_width_b)/2
draw2.text((starting_coord_b, 1), time_t_b, time_colors1[time_color2_b], font_1_b) draw2.text((starting_coord_b, 1), time_t_b, time_colors1[time_color2_b], font_1_b)
draw2.text((starting_coord_b + text_width_b + 6, 1), date_t_b, time_colors1[date_color2_b], font_2_b) draw2.text((starting_coord_b + text_width_b + 5, 1), date_t_b, time_colors1[date_color2_b], font_2_b)
draw2.text((starting_coord_b + text_width_b + 7, 8), weekday_t_b, time_colors1[weekday_color2_b], font_2_b) draw2.text((starting_coord_b + text_width_b + 6, 8), weekday_t_b, time_colors1[weekday_color2_b], font_2_b)
#If time now is greater than 1 second of the previously updated image time, update image and reset updated image time to another second #If time now is greater than 1 second of the previously updated image time, update image and reset updated image time to another second
if time.time() >= the_time2 + 1: if time.time() >= the_time2 + 1:
the_time2 = time.time() the_time2 = time.time()
@ -1475,11 +1475,11 @@ class StockTicker():
date_width_b, date_height_b = draw2.textsize(date_t_b, font_2_b) date_width_b, date_height_b = draw2.textsize(date_t_b, font_2_b)
wday_width_b, wday_height_b = draw2.textsize(weekday_t_b, font_2_b) wday_width_b, wday_height_b = draw2.textsize(weekday_t_b, font_2_b)
text_width_b, text_height_b = draw2.textsize(time_t_b, font_1_b) text_width_b, text_height_b = draw2.textsize(time_t_b, font_1_b)
total_width_b = text_width_b + 6 + max(wday_width_b, date_width_b) total_width_b = text_width_b + 5 + max(wday_width_b, date_width_b)
starting_coord_b = (128-total_width_b)/2 starting_coord_b = (128-total_width_b)/2
draw2.text((starting_coord_b, 1), time_t_b, time_colors1[time_color2_b], font_1_b) draw2.text((starting_coord_b, 1), time_t_b, time_colors1[time_color2_b], font_1_b)
draw2.text((starting_coord_b + text_width_b + 6, 1), date_t_b, time_colors1[date_color2_b], font_2_b) draw2.text((starting_coord_b + text_width_b + 5, 1), date_t_b, time_colors1[date_color2_b], font_2_b)
draw2.text((starting_coord_b + text_width_b + 7, 8), weekday_t_b, time_colors1[weekday_color2_b], font_2_b) draw2.text((starting_coord_b + text_width_b + 6, 8), weekday_t_b, time_colors1[weekday_color2_b], font_2_b)
if time.time() - update_t2 > delay_t2: if time.time() - update_t2 > delay_t2:
update_t2 = time.time() update_t2 = time.time()
#Get the pause time right before image is done transitioning in #Get the pause time right before image is done transitioning in