From c83fd8edf21ac9d17905be481d776740b007bf48 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 7 Sep 2020 09:25:54 +1000 Subject: [PATCH] AP_MSP: fixed use of float in pygame for py3 --- libraries/AP_MSP/Tools/msposd.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libraries/AP_MSP/Tools/msposd.py b/libraries/AP_MSP/Tools/msposd.py index cfbde41215..b884503399 100755 --- a/libraries/AP_MSP/Tools/msposd.py +++ b/libraries/AP_MSP/Tools/msposd.py @@ -98,7 +98,7 @@ def display_text(item, message, x_offset=0): def draw_gauge(x, y, width, height, perc): '''draw an horizontal gauge''' pygame.draw.rect(display_surface, (255, 255, 255), (x, y, width, height), 1) - pygame.draw.rect(display_surface, (255, 255, 255), (x+2, y+2, (width-4)*perc/100, height-4)) + pygame.draw.rect(display_surface, (255, 255, 255), (x+2, y+2, int((width-4)*perc/100), height-4)) def draw_batt_icon(x, y): pygame.draw.rect(display_surface, (255, 255, 255), (x+1, y, 6, 3)) @@ -107,20 +107,20 @@ def draw_batt_icon(x, y): def draw_triangle(x, y, r, angle): a = angle -90 ra = math.radians(a) - x1 = x + r * math.cos(ra) - y1 = y + r * math.sin(ra) + x1 = int(x + r * math.cos(ra)) + y1 = int(y + r * math.sin(ra)) ra = math.radians(a + 140) - x2 = x + r * math.cos(ra) - y2 = y + r * math.sin(ra) + x2 = int(x + r * math.cos(ra)) + y2 = int(y + r * math.sin(ra)) ra = math.radians(a - 140) - x3 = x + r * math.cos(ra) - y3 = y + r * math.sin(ra) + x3 = int(x + r * math.cos(ra)) + y3 = int(y + r * math.sin(ra)) ra = math.radians(angle - 270) - x4 = x + r * 0.5 * math.cos(ra) - y4 = y + r * 0.5 *math.sin(ra) + x4 = int(x + r * 0.5 * math.cos(ra)) + y4 = int(y + r * 0.5 *math.sin(ra)) pygame.draw.line(display_surface, (255, 255, 255), (x1, y1), (x2, y2), 2) pygame.draw.line(display_surface, (255, 255, 255), (x1, y1), (x3, y3), 2)