Closed
Description
If you pass something other than 0.0
in the constructor and then do not ever set progress
again the bar will not get drawn correctly.
It's due to the newest update that added some efficiency when drawing. So older versions likely did not have this problem.
code to reproduce:
import board
import displayio
from adafruit_progressbar import ProgressBar
# Make the display context
group = displayio.Group(max_size=2)
board.DISPLAY.show(group)
x = board.DISPLAY.width // 5
y = board.DISPLAY.height // 3
progress_bar = ProgressBar(x, y, 200, 30, 0.5)
group.append(progress_bar)
while True:
pass
Instead of the progress bar being drawn half full there is only a single line drawn in the middle.
I think the easiest fix is to change init
to use 0.0
first and then set progress
afterward.
The previous code produces a correct looking result if you change it like this:
progress_bar = ProgressBar(x, y, 200, 30, 0.0)
progress_bar.progress = 0.5