From ca740d1fc923abd0d28fee18b9d988dc35fa4e3b Mon Sep 17 00:00:00 2001 From: Dan Lawrence Date: Sun, 3 Nov 2024 15:48:01 +0000 Subject: [PATCH] Add better option to disable hiding/showing contained elements of containers --- pygame_gui/elements/ui_scrolling_container.py | 3 ++- pygame_gui/elements/ui_window.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pygame_gui/elements/ui_scrolling_container.py b/pygame_gui/elements/ui_scrolling_container.py index 633d82a9..8df67613 100644 --- a/pygame_gui/elements/ui_scrolling_container.py +++ b/pygame_gui/elements/ui_scrolling_container.py @@ -524,6 +524,7 @@ def show(self, show_contents: bool = True): """ super().show() + self._root_container.show(show_contents=False) if self.vert_scroll_bar is not None: self.vert_scroll_bar.show() if self.horiz_scroll_bar is not None: @@ -543,7 +544,7 @@ def hide(self, hide_contents: bool = True): """ if not self.visible: return - + self._root_container.hide(hide_contents=False) if self.vert_scroll_bar is not None: self.vert_scroll_bar.hide() if self.horiz_scroll_bar is not None: diff --git a/pygame_gui/elements/ui_window.py b/pygame_gui/elements/ui_window.py index 338884b0..e0a8e905 100644 --- a/pygame_gui/elements/ui_window.py +++ b/pygame_gui/elements/ui_window.py @@ -758,6 +758,7 @@ def show(self, show_contents: bool = True): :param show_contents: whether to also show the contents of the window. Defaults to True. """ super().show() + self._window_root_container.show(show_contents=False) if self.title_bar is not None: self.title_bar.show() if self.close_window_button is not None: @@ -776,6 +777,7 @@ def hide(self, hide_contents: bool = True): return super().hide() + self._window_root_container.hide(hide_contents=False) if self.title_bar is not None: self.title_bar.hide() if self.close_window_button is not None: