Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If starting progress != 0.0 and not updated it gets drawn incorrectly #12

Closed
FoamyGuy opened this issue Aug 2, 2020 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@FoamyGuy
Copy link
Contributor

FoamyGuy commented Aug 2, 2020

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
@FoamyGuy FoamyGuy added the bug Something isn't working label Aug 5, 2020
@FoamyGuy
Copy link
Contributor Author

resolved by #13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant