fixed zero division with async total
This commit is contained in:
parent
6351381789
commit
3e3dbcdda8
@ -219,8 +219,9 @@ class Editor:
|
|||||||
h2 = self.height / 2
|
h2 = self.height / 2
|
||||||
x0 = w2 - width / 2
|
x0 = w2 - width / 2
|
||||||
y0 = h2 - height / 2
|
y0 = h2 - height / 2
|
||||||
|
loaded_width = 0 if total == 0 else width * count / total
|
||||||
pygame.draw.rect(self.win, (160, 160, 160), [x0, y0, width, height])
|
pygame.draw.rect(self.win, (160, 160, 160), [x0, y0, width, height])
|
||||||
pygame.draw.rect(self.win, (90, 250, 90), [x0, y0, width * count / total, height])
|
pygame.draw.rect(self.win, (90, 250, 90), [x0, y0, loaded_width, height])
|
||||||
self.win.blit(txt, [w2 - txt.get_width() / 2, y0 - txt.get_height() - 5])
|
self.win.blit(txt, [w2 - txt.get_width() / 2, y0 - txt.get_height() - 5])
|
||||||
|
|
||||||
pygame.display.flip()
|
pygame.display.flip()
|
||||||
|
Loading…
Reference in New Issue
Block a user