Skip to content

Commit 8407b23

Browse files
committed
Add docstrings to the created base class
1 parent b733a99 commit 8407b23

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Adafruit_ProgressBar/adafruit_progressbar_base.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,27 @@
2929

3030

3131
class ProgressBarBase(displayio.TileGrid):
32+
"""The base class for dynamic progress bar widgets.
33+
34+
:param (int, int) position: The coordinates (x, y) of the top left corner
35+
:param (int, int) size: The size (width, height) of the progress bar
36+
:param flaot start_value: The beginning value of the progress bar. This value
37+
is displayed when the progress bar is first visible,
38+
if it hasn't been updated.
39+
:param int bar_color: The color of the bar representing the value. This can
40+
be a hexadecimal value for color (0x224466).
41+
Default: 0x00FF00 (Solid green)
42+
:param int outline_color: The color of the border around the progress bar. This
43+
can be a hexadecimal value for color (0x4488BB).
44+
Default: 0xFFFFFF (White)
45+
:param int fill_color: The colour of the bar representing the remainder of the
46+
value. i.e. if the current value is 42%, the 42 value
47+
is represented by the bar_color parameter. The remainder,
48+
58%, will be displayed in this color. This can also
49+
be a hexadecimal value for color (0xEE7755).
50+
Default: 0x000000 (Black)
51+
"""
52+
3253
def __init__(
3354
self,
3455
position: (int, int),
@@ -63,28 +84,36 @@ def __init__(
6384

6485
@property.getter
6586
def width(self):
87+
"""The total width of the widget"""
6688
return self._size[0]
6789

6890
@property.getter
6991
def height(self):
92+
"""The total height of the widget"""
7093
return self._size[1]
7194

7295
@property.getter
7396
def x(self):
97+
"""The horizontal (x) position of the top-left corner of the widget"""
7498
return self._position[0]
7599

76100
@property.getter
77101
def y(self):
102+
"""The vertical (y) position of the top-left corner of the widget"""
78103
return self._position[1]
79104

80105
@property
81106
def progress(self):
107+
"""The current displayed value of the widget"""
82108
return self._progress
83109

84110
@property.setter
85111
def progress(self, value):
112+
"""Sets/updates the displayed value"""
86113
self._progress = value
87114
self.render()
88115

89116
def render(self):
117+
"""The method called when the display needs to be updated. This method
118+
can be overridden in child classes to handle the graphics appropriately."""
90119
pass

0 commit comments

Comments
 (0)