From 44023b141a525db6549b4f15729d43d6e39cc8b5 Mon Sep 17 00:00:00 2001 From: Dan Lawrence Date: Mon, 30 Dec 2024 20:06:08 +0000 Subject: [PATCH] document progress bar methods/property --- pygame_gui/elements/ui_progress_bar.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pygame_gui/elements/ui_progress_bar.py b/pygame_gui/elements/ui_progress_bar.py index 10d66af8..d2a8bdd9 100644 --- a/pygame_gui/elements/ui_progress_bar.py +++ b/pygame_gui/elements/ui_progress_bar.py @@ -47,6 +47,11 @@ def __init__(self, @property def progress_percentage(self): + """ + Get the current percentage progress of the bar from 0.0 to 1.0 + + :return: a float from 0.0 to 1.0 + """ return self.current_progress / self.maximum_progress def status_text(self): @@ -54,6 +59,11 @@ def status_text(self): return f"{self.current_progress:0.1f}/{self.maximum_progress:0.1f}" def set_current_progress(self, progress: float): + """ + Set the current percentage progress of the bar + + :param progress: a float from 0.0 to 100.0 + """ # Now that we subclass UIStatusBar, set_current_progress() and self.current_progress are mostly here for backward compatibility. self.current_progress = progress