Skip to content

Commit f4b101d

Browse files
authored
Merge pull request #663 from MyreMylar/progress-docs
document progress bar methods/property
2 parents a2fc015 + 44023b1 commit f4b101d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pygame_gui/elements/ui_progress_bar.py

+10
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,23 @@ def __init__(self,
4747

4848
@property
4949
def progress_percentage(self):
50+
"""
51+
Get the current percentage progress of the bar from 0.0 to 1.0
52+
53+
:return: a float from 0.0 to 1.0
54+
"""
5055
return self.current_progress / self.maximum_progress
5156

5257
def status_text(self):
5358
""" Subclass and override this method to change what text is displayed, or to suppress the text. """
5459
return f"{self.current_progress:0.1f}/{self.maximum_progress:0.1f}"
5560

5661
def set_current_progress(self, progress: float):
62+
"""
63+
Set the current percentage progress of the bar
64+
65+
:param progress: a float from 0.0 to 100.0
66+
"""
5767
# Now that we subclass UIStatusBar, set_current_progress() and self.current_progress are mostly here for backward compatibility.
5868
self.current_progress = progress
5969

0 commit comments

Comments
 (0)