Display speed in mph in centre of speedo

This commit is contained in:
XANTRONIX Development 2024-01-01 19:30:43 -05:00
parent 490390a433
commit 897e1e9661

View file

@ -41,3 +41,18 @@ class Speedo(Dial):
for speed in range(0, int(self.max_value)+1, 20):
self.draw_number(cr, 0.68, speed, "%d" % int(speed))
def draw_fg(self, cr: cairo.Context):
super().draw_fg(cr)
cr.select_font_face("Muli",
cairo.FontSlant.ITALIC,
cairo.FontWeight.BOLD)
cr.set_font_size(self.radius * 0.15)
cr.set_source_rgb(1, 0.4, 1)
cr.move_to(self.x - (self.radius * 0.21),
self.y + (self.radius * 0.05))
cr.show_text("%d mph" % self.value)