Skip to content

Commit 112fa12

Browse files
committed
make width and height public
1 parent 2fb1bd1 commit 112fa12

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

adafruit_progressbar.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ def __init__(
8080
self._palette[1] = outline_color
8181
self._palette[2] = bar_color
8282

83-
self._width = width
84-
self._height = height
83+
self.width = width
84+
self.height = height
8585

8686
self._progress_val = 0.0
8787
self.progress = self._progress_val
@@ -119,17 +119,17 @@ def progress(self, value):
119119
if self._progress_val > value:
120120
# uncolorize range from width*value+margin to width-margin
121121
# from right to left
122-
_prev_pixel = max(2, int(self._width * self._progress_val - 2))
123-
_new_pixel = max(int(self._width * value - 2), 2)
122+
_prev_pixel = max(2, int(self.width * self._progress_val - 2))
123+
_new_pixel = max(int(self.width * value - 2), 2)
124124
for _w in range(_prev_pixel, _new_pixel - 1, -1):
125-
for _h in range(2, self._height - 2):
125+
for _h in range(2, self.height - 2):
126126
self._bitmap[_w, _h] = 0
127127
else:
128128
# fill from the previous x pixel to the new x pixel
129-
_prev_pixel = max(2, int(self._width * self._progress_val - 3))
130-
_new_pixel = min(int(self._width * value - 2), int(self._width * 1.0 - 3))
129+
_prev_pixel = max(2, int(self.width * self._progress_val - 3))
130+
_new_pixel = min(int(self.width * value - 2), int(self.width * 1.0 - 3))
131131
for _w in range(_prev_pixel, _new_pixel + 1):
132-
for _h in range(2, self._height - 2):
132+
for _h in range(2, self.height - 2):
133133
self._bitmap[_w, _h] = 2
134134
self._progress_val = value
135135

0 commit comments

Comments
 (0)