diff --git a/docs/source/quick_start.rst b/docs/source/quick_start.rst index 104a15da..e3d07b11 100644 --- a/docs/source/quick_start.rst +++ b/docs/source/quick_start.rst @@ -233,7 +233,7 @@ we can just compare the event's ui_element attribute with our hello_button varia Try running the code again and clicking on the button. If it's all worked you should see 'Hello World!' printed to the python console each time you click the button. -Now that we've got the basics of the code up and running, let's try experimenting with a custom them file in part 2 of +Now that we've got the basics of the code up and running, let's try experimenting with a custom theme file in part 2 of this quick start guide: Quick Start Guides diff --git a/docs/source/theme_guide.rst b/docs/source/theme_guide.rst index e5e14949..478faae9 100644 --- a/docs/source/theme_guide.rst +++ b/docs/source/theme_guide.rst @@ -134,11 +134,11 @@ within the colours block you can start to set individual colours by their IDs. I * - HSL - Degree, 2 Percentage Values - :example-hsl:`hsl(190deg, 40%, .5)` - - Hue, Saturation, Luminence + - Hue, Saturation, Luminance * - HSLA - Degree, 3 Percentage Values - :example-hsla:`hsla(10deg, 40%, .5, 0.7)` - - Hue, Saturation, Luminence, Alpha + - Hue, Saturation, Luminance, Alpha * - HSV - Degree, 2 Percentage Values - :example-hsv:`hsv(282deg, 63%, 92%)` @@ -150,7 +150,7 @@ within the colours block you can start to set individual colours by their IDs. I * - CMY - 3 percentage values - :example-cmy:`cmy(.3, .5, .7)` - - Cyan, Magneta, Yellow + - Cyan, Magenta, Yellow .. list-table:: Value Types :widths: 10 40 20 20 20 diff --git a/docs/source/theme_reference/theme_progress_bar.rst b/docs/source/theme_reference/theme_progress_bar.rst index 416b8949..b68dc74a 100644 --- a/docs/source/theme_reference/theme_progress_bar.rst +++ b/docs/source/theme_reference/theme_progress_bar.rst @@ -23,7 +23,7 @@ Colours :class:`UIProgressBar ` makes use of these colour parameters in a 'colours' block. Most of these colours can also be a colour gradient: - - "**normal_text**" - The colour/gradient of the health bars's text. + - "**normal_text**" - The colour/gradient of the health bar's text. - "**text_shadow**" - The colour of the shadow behind the text (so it stands out better). - "**normal_border**" - The colour/gradient of the border around the health bar. - "**filled_bar**" - The colour/gradient of the actual bar itself, of the portion of it that is still full. diff --git a/docs/source/theme_reference/theme_screen_space_health_bar.rst b/docs/source/theme_reference/theme_screen_space_health_bar.rst index e8c29c8c..b9c092ee 100644 --- a/docs/source/theme_reference/theme_screen_space_health_bar.rst +++ b/docs/source/theme_reference/theme_screen_space_health_bar.rst @@ -23,7 +23,7 @@ Colours :class:`UIScreenSpaceHealthBar ` makes use of these colour parameters in a 'colours' block. Most of these colours can also be a colour gradient: - - "**normal_text**" - The colour/gradient of the health bars's text. + - "**normal_text**" - The colour/gradient of the health bar's text. - "**text_shadow**" - The colour of the shadow behind the text (so it stands out better). - "**normal_border**" - The colour/gradient of the border around the health bar. - "**filled_bar**" - The colour/gradient of the actual bar itself, of the portion of it that is still full. diff --git a/pygame_gui/elements/ui_scrolling_container.py b/pygame_gui/elements/ui_scrolling_container.py index e531619c..52546476 100644 --- a/pygame_gui/elements/ui_scrolling_container.py +++ b/pygame_gui/elements/ui_scrolling_container.py @@ -87,7 +87,7 @@ def __init__(self, # scroll bars so that it resizes automatically as the scroll bars are added and "removed". # this contains the scroll bars and the 'view' container - self._root_container = UIContainer(relative_rect=relative_rect, + self._root_container = UIContainer(relative_rect=self.relative_rect, manager=manager, starting_height=starting_height, container=container, @@ -106,7 +106,7 @@ def __init__(self, self.vert_scroll_bar = None if self.allow_scroll_y: - scroll_bar_rect = pygame.Rect(-20, 0, 20, relative_rect.height) + scroll_bar_rect = pygame.Rect(-20, 0, 20, self.relative_rect.height) self.vert_scroll_bar = UIVerticalScrollBar(relative_rect=scroll_bar_rect, visible_percentage=1.0, manager=self.ui_manager, @@ -117,7 +117,7 @@ def __init__(self, 'top': 'top', 'bottom': 'bottom'}) - self.vert_scroll_bar.set_dimensions((0, relative_rect.height)) # TODO: Remove these when anchoring is fixed + self.vert_scroll_bar.set_dimensions((0, self.relative_rect.height)) # TODO: Remove these when anchoring is fixed self.vert_scroll_bar.set_relative_position((0, 0)) # Without this, they look off-centered self.join_focus_sets(self.vert_scroll_bar) @@ -125,7 +125,7 @@ def __init__(self, self.horiz_scroll_bar = None if self.allow_scroll_x: - scroll_bar_rect = pygame.Rect(0, -20, relative_rect.width, 20) + scroll_bar_rect = pygame.Rect(0, -20, self.relative_rect.width, 20) self.horiz_scroll_bar = UIHorizontalScrollBar(relative_rect=scroll_bar_rect, visible_percentage=1.0, manager=self.ui_manager, @@ -136,7 +136,7 @@ def __init__(self, 'top': 'bottom', 'bottom': 'bottom'}) - self.horiz_scroll_bar.set_dimensions((relative_rect.width, 0)) + self.horiz_scroll_bar.set_dimensions((self.relative_rect.width, 0)) self.horiz_scroll_bar.set_relative_position((0, 0)) self.join_focus_sets(self.horiz_scroll_bar) @@ -144,7 +144,7 @@ def __init__(self, # This container is the view on to the scrollable container it's size is determined by # the size of the root container and whether there are any scroll bars or not. - view_rect = pygame.Rect(0, 0, relative_rect.width, relative_rect.height) + view_rect = pygame.Rect(0, 0, self.relative_rect.width, self.relative_rect.height) self._view_container = UIContainer(relative_rect=view_rect, manager=manager, starting_height=1, @@ -158,7 +158,7 @@ def __init__(self, # This container is what we actually put other stuff in. # It is aligned to the top left corner but that isn't that important for a container that # can be much larger than it's view - scrollable_rect = pygame.Rect(0, 0, relative_rect.width, relative_rect.height) + scrollable_rect = pygame.Rect(0, 0, self.relative_rect.width, self.relative_rect.height) scrollable_anchors = {'left': 'left', 'right': 'left', 'top': 'top', @@ -415,9 +415,7 @@ def _sort_out_element_container_scroll_bars(self): self.vert_scroll_bar.set_visible_percentage(vis_percent) self.vert_scroll_bar.set_relative_position((-self.scroll_bar_width, 0)) - # This is important as horiz scroll bar's dimensions are evaluated after. If horizontal scrollbar is not - # needed, then scroll bar height is 0. - height = self._view_container.rect.height - self.scroll_bar_height + height = self._view_container.rect.height self.vert_scroll_bar.set_dimensions((self.scroll_bar_width, height)) else: diff --git a/tests/test_elements/test_ui_scrolling_container.py b/tests/test_elements/test_ui_scrolling_container.py index 1fe3dca6..666045bd 100644 --- a/tests/test_elements/test_ui_scrolling_container.py +++ b/tests/test_elements/test_ui_scrolling_container.py @@ -179,7 +179,7 @@ def test_update(self, _init_pygame, default_ui_manager, container.update(0.02) - assert container.get_container().get_relative_rect().y == -12 + assert container.get_container().get_relative_rect().y == -11 container.horiz_scroll_bar.scroll_wheel_moved = True container.horiz_scroll_bar.scroll_wheel_amount = -5.0