Skip to content

Commit ff491aa

Browse files
Fix pad at end of screen on some bar numbers
1 parent 12a9dc8 commit ff491aa

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

‎main.py‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def genList(self):
2424
self.len_list = len(self.list)
2525
self.sorted_list = sorted(self.list)
2626
self.reverse_list = sorted(self.list, reverse=True)
27-
self.bar_width = self.width // self.len_list
27+
self.bar_width = self.width / self.len_list
2828
self.bar_height = (self.height - self.top_pad) // max(self.list)
2929

3030
def setTick(self, speed):
@@ -122,7 +122,12 @@ def drawList(self, clear_bg=False):
122122
(self.reverse_list.index(val) + 1) / self.len_list * 255,
123123
255,
124124
)
125-
pygame.draw.rect(self.window, color, (x, y, self.bar_width, self.height))
125+
pygame.draw.rect(
126+
self.window,
127+
color,
128+
# FIXME small gap between lines on some bar numbers
129+
(x, y, self.bar_width, self.height),
130+
)
126131
pygame.display.update()
127132

128133
# Algorithm Methods

0 commit comments

Comments
 (0)