oh yeah it's python
This commit is contained in:
parent
36b1fd4aa8
commit
6c083e13df
@ -93,11 +93,11 @@ class SoundslabDisplay:
|
|||||||
offset_from_top = 21 # start at the 21st row of pixels to draw inside the outer overlay
|
offset_from_top = 21 # start at the 21st row of pixels to draw inside the outer overlay
|
||||||
font = ImageFont.truetype(font='/usr/share/fonts/truetype/hack/Hack-Regular.ttf', size=14)
|
font = ImageFont.truetype(font='/usr/share/fonts/truetype/hack/Hack-Regular.ttf', size=14)
|
||||||
for row in menu_data:
|
for row in menu_data:
|
||||||
if row.selected:
|
if row["selected"]:
|
||||||
menu_overlay.rectangle([(21, offset_from_top),(self.screen_size[0] - 21, offset_from_top + 40)], self.bg_color) # highlight background for selected menu item
|
menu_overlay.rectangle([(21, offset_from_top),(self.screen_size[0] - 21, offset_from_top + 40)], self.bg_color) # highlight background for selected menu item
|
||||||
|
|
||||||
output_size = menu_overlay.textsize(output) # get the size of the text to draw so we can center it in our rectangle for this row
|
output_size = menu_overlay.textsize(row["output"]) # get the size of the text to draw so we can center it in our rectangle for this row
|
||||||
menu_overlay.text((21 + floor(output_size[0] / 2), offset_from_top + (40 - floor(output_size[1] / 2))), row.output, font=font, fill=self.fg_color if row.selected else self.bg_color) # draw output text in appropriate color
|
menu_overlay.text((21 + floor(output_size[0] / 2), offset_from_top + (40 - floor(output_size[1] / 2))), row["output"], font=font, fill=self.fg_color if row["selected"] else self.bg_color) # draw output text in appropriate color
|
||||||
offset_from_top += 40
|
offset_from_top += 40
|
||||||
|
|
||||||
# finally, set the current_menu image
|
# finally, set the current_menu image
|
||||||
|
Loading…
Reference in New Issue
Block a user