Skip to content

Commit

Permalink
minor fixes to slider/scrollbar
Browse files Browse the repository at this point in the history
  • Loading branch information
MyreMylar committed Nov 3, 2024
1 parent ecf347c commit 6773831
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
6 changes: 4 additions & 2 deletions pygame_gui/elements/ui_horizontal_scroll_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ def __init__(self,

self.drawable_shape = None
self.shape = 'rectangle'
self.left_arrow_text = '◀'
self.right_arrow_text = '▶'

self.background_rect = None # type: Union[None, pygame.Rect]

Expand Down Expand Up @@ -179,7 +181,7 @@ def rebuild(self):
self.left_button = UIButton(pygame.Rect((0, 0),
(self.arrow_button_width,
self.background_rect.height)),
'◀', self.ui_manager,
self.left_arrow_text, self.ui_manager,
container=self.button_container,
starting_height=1,
parent_element=self,
Expand All @@ -195,7 +197,7 @@ def rebuild(self):
self.right_button = UIButton(pygame.Rect((-self.arrow_button_width, 0),
(self.arrow_button_width,
self.background_rect.height)),
'▶', self.ui_manager,
self.right_arrow_text, self.ui_manager,
container=self.button_container,
starting_height=1,
parent_element=self,
Expand Down
7 changes: 5 additions & 2 deletions pygame_gui/elements/ui_horizontal_slider.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ def __init__(self,
self.left_limit_position = 0.0
self.starting_grab_x_difference = 0

self.left_arrow_text = '◀'
self.right_arrow_text = '▶'

if (isinstance(start_value, int) and
isinstance(value_range[0], int) and
isinstance(value_range[1], int)):
Expand Down Expand Up @@ -181,7 +184,7 @@ def rebuild(self):
self.left_button = UIButton(pygame.Rect((0, 0),
(self.arrow_button_width,
self.background_rect.height)),
'◀', self.ui_manager,
self.left_arrow_text, self.ui_manager,
container=self.button_container,
starting_height=1,
parent_element=self,
Expand All @@ -197,7 +200,7 @@ def rebuild(self):
self.right_button = UIButton(pygame.Rect((-self.arrow_button_width, 0),
(self.arrow_button_width,
self.background_rect.height)),
'▶', self.ui_manager,
self.right_arrow_text, self.ui_manager,
container=self.button_container,
starting_height=1,
parent_element=self,
Expand Down
6 changes: 4 additions & 2 deletions pygame_gui/elements/ui_vertical_scroll_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ def __init__(self,
self.bottom_button = None
self.sliding_button = None
self.enable_arrow_buttons = True
self.top_arrow_text = '▲'
self.bottom_arrow_text = '▼'

self.rebuild_from_changed_theme_data()

Expand Down Expand Up @@ -175,7 +177,7 @@ def rebuild(self):
self.top_button = UIButton(pygame.Rect((0, 0),
(self.background_rect.width,
self.arrow_button_height)),
'▲', self.ui_manager,
self.top_arrow_text, self.ui_manager,
container=self.button_container,
starting_height=1,
parent_element=self,
Expand All @@ -191,7 +193,7 @@ def rebuild(self):
self.bottom_button = UIButton(pygame.Rect((0, -self.arrow_button_height),
(self.background_rect.width,
self.arrow_button_height)),
'▼', self.ui_manager,
self.bottom_arrow_text, self.ui_manager,
container=self.button_container,
starting_height=1,
parent_element=self,
Expand Down

0 comments on commit 6773831

Please sign in to comment.