Skip to content

Commit b50adcb

Browse files
committed
Added ability to have progressbar border and bg didabeld
1 parent 1dbfef0 commit b50adcb

File tree

4 files changed

+75
-5
lines changed

4 files changed

+75
-5
lines changed

.gitignore

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
*.egg-info/
24+
.installed.cfg
25+
*.egg
26+
MANIFEST
27+
28+
# PyInstaller
29+
# Usually these files are written by a python script from a template
30+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
31+
*.manifest
32+
*.spec
33+
34+
# Installer logs
35+
pip-log.txt
36+
pip-delete-this-directory.txt
37+
38+
# Unit test / coverage reports
39+
htmlcov/
40+
.tox/
41+
.coverage
42+
.coverage.*
43+
.cache
44+
nosetests.xml
45+
coverage.xml
46+
*.cover
47+
.hypothesis/
48+
.pytest_cache/
49+
50+
# Environments
51+
.env
52+
.venv
53+
env/
54+
venv/
55+
ENV/
56+
env.bak/
57+
venv.bak/
58+
59+
# IDE specific files
60+
.idea/
61+
.vscode/
62+
*.swp
63+
*.swo
64+
65+
# Jupyter Notebook
66+
.ipynb_checkpoints
257 Bytes
Binary file not shown.

docs/components/progressBar.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ centered: bool = False
4343
- `max_progress`: Maximum value for the progress bar
4444
- `min_progress`: Minimum value for the progress bar
4545
- `color`: Color of the progress bar fill
46-
- `background_color`: Color of the unfilled portion
46+
- `background_color`: Color of the unfilled portion, set to None for no background
4747
- `border_radius`: Radius for rounded corners
48-
- `border_color`: Color of the border around the progress bar
48+
- `border_color`: Color of the border around the progress bar, set to None for no border
4949
- `border_width`: Width of the border
5050
- `centered`: If True, the progress bar is centered on the provided position
5151

pygameui.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,6 +1017,8 @@ def __init__(self,
10171017
:param min_progress: Minimum progress amount
10181018
:param color: Color of the progress
10191019
:param border_radius: Radius of the border
1020+
:param background_color: Color of the background, set to None to disable the background
1021+
:param border_color: Color of the border, set to None to disable the border
10201022
:param border_width: Width of the border
10211023
:param centered: If the progress will be centered in the position
10221024
"""
@@ -1127,11 +1129,13 @@ def draw(self, surface: pygame.Surface) -> None:
11271129
return
11281130

11291131
# Draw the background
1130-
pygame.draw.rect(surface, self._background_color, self._rect, border_radius=self._border_radius)
1132+
if self._background_color:
1133+
pygame.draw.rect(surface, self._background_color, self._rect, border_radius=self._border_radius)
11311134
# Draw the progress bar
11321135
pygame.draw.rect(surface, self._progress_bar_color, self._progress_bar, border_radius=self._border_radius)
11331136
# Draw the border
1134-
pygame.draw.rect(surface, self._border_color, self._rect, self._border_width, border_radius=self._border_radius)
1137+
if self._border_color:
1138+
pygame.draw.rect(surface, self._border_color, self._rect, self._border_width, border_radius=self._border_radius)
11351139

11361140
def update(self, _=None) -> None:
11371141
"""
@@ -1141,4 +1145,4 @@ def update(self, _=None) -> None:
11411145
super().update()
11421146
self._update_progress_bar()
11431147

1144-
1148+
#class DropDownMenu(Element):

0 commit comments

Comments
 (0)