Skip to content

Commit ec5def5

Browse files
committed
UI2DSlider
1 parent 31ecab9 commit ec5def5

File tree

4 files changed

+503
-13
lines changed

4 files changed

+503
-13
lines changed

pygame_gui/_constants.py

+2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def __eq__(self, other):
6262
UI_TEXT_ENTRY_FINISHED = custom_type()
6363
UI_DROP_DOWN_MENU_CHANGED = custom_type()
6464
UI_HORIZONTAL_SLIDER_MOVED = custom_type()
65+
UI_2D_SLIDER_MOVED = custom_type()
6566
UI_SELECTION_LIST_NEW_SELECTION = custom_type()
6667
UI_SELECTION_LIST_DROPPED_SELECTION = custom_type()
6768
UI_SELECTION_LIST_DOUBLE_CLICKED_SELECTION = custom_type()
@@ -244,6 +245,7 @@ def __eq__(self, other):
244245
'UI_TEXT_ENTRY_FINISHED',
245246
'UI_DROP_DOWN_MENU_CHANGED',
246247
'UI_HORIZONTAL_SLIDER_MOVED',
248+
'UI_2D_SLIDER_MOVED',
247249
'UI_SELECTION_LIST_NEW_SELECTION',
248250
'UI_SELECTION_LIST_DROPPED_SELECTION',
249251
'UI_SELECTION_LIST_DOUBLE_CLICKED_SELECTION',

pygame_gui/core/ui_element.py

+4-12
Original file line numberDiff line numberDiff line change
@@ -727,9 +727,7 @@ def update_containing_rect_position(self):
727727

728728
self._update_container_clip()
729729

730-
def set_relative_position(self, position: Union[pygame.math.Vector2,
731-
Tuple[int, int],
732-
Tuple[float, float]]):
730+
def set_relative_position(self, position: Union[pygame.math.Vector2, Tuple[int, int], Tuple[float, float]]):
733731
"""
734732
Method to directly set the relative rect position of an element.
735733
@@ -747,9 +745,7 @@ def set_relative_position(self, position: Union[pygame.math.Vector2,
747745
self._update_container_clip()
748746
self.ui_container.on_contained_elements_changed(self)
749747

750-
def set_position(self, position: Union[pygame.math.Vector2,
751-
Tuple[int, int],
752-
Tuple[float, float]]):
748+
def set_position(self, position: Union[pygame.math.Vector2, Tuple[int, int], Tuple[float, float]]):
753749
"""
754750
Method to directly set the absolute screen rect position of an element.
755751
@@ -765,9 +761,7 @@ def set_position(self, position: Union[pygame.math.Vector2,
765761
self._update_container_clip()
766762
self.ui_container.on_contained_elements_changed(self)
767763

768-
def set_minimum_dimensions(self, dimensions: Union[pygame.math.Vector2,
769-
Tuple[int, int],
770-
Tuple[float, float]]):
764+
def set_minimum_dimensions(self, dimensions: Union[pygame.math.Vector2, Tuple[int, int], Tuple[float, float]]):
771765
"""
772766
If this window is resizable, then the dimensions we set here will be the minimum that
773767
users can change the window to. They are also used as the minimum size when
@@ -785,9 +779,7 @@ def set_minimum_dimensions(self, dimensions: Union[pygame.math.Vector2,
785779
new_height = max(self.minimum_dimensions[1], self.rect.height)
786780
self.set_dimensions((new_width, new_height))
787781

788-
def set_dimensions(self, dimensions: Union[pygame.math.Vector2,
789-
Tuple[int, int],
790-
Tuple[float, float]],
782+
def set_dimensions(self, dimensions: Union[pygame.math.Vector2, Tuple[int, int], Tuple[float, float]],
791783
clamp_to_container: bool = False):
792784
"""
793785
Method to directly set the dimensions of an element.

pygame_gui/elements/__init__.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from pygame_gui.elements.ui_text_entry_box import UITextEntryBox
2020
from pygame_gui.elements.ui_auto_resizing_container import UIAutoResizingContainer
2121
from pygame_gui.elements.ui_auto_scrolling_container import UIAutoScrollingContainer
22+
from pygame_gui.elements.ui_2d_slider import UI2DSlider
2223

2324

2425
__all__ = ['UIImage',
@@ -42,4 +43,5 @@
4243
'UIScrollingContainer',
4344
'UITextEntryBox',
4445
'UIAutoResizingContainer',
45-
'UIAutoScrollingContainer']
46+
'UIAutoScrollingContainer',
47+
'UI2DSlider']

0 commit comments

Comments
 (0)