Repository: myremylar/pygame_gui
Issue: Make starting layer height params consistent

Just a small UX issue. In `UIPanel` the param is `starting_layer_height` but in `UIElement` it's `starting_height`, while in `UITextBox` it's `layer_starting_height`.

**Expected behaviour**
Preferably these would all be the same param name, unless you have a particular design reason for them not to be (in which case maybe clarify in the documentation?).


Changed files:
pygame_gui/elements/ui_text_box.py, tests/test_elements/test_ui_panel.py, pygame_gui/elements/ui_tool_tip.py, pygame_gui/elements/ui_panel.py, tests/test_elements/test_ui_text_box.py

diff --git a/pygame_gui/elements/ui_panel.py b/pygame_gui/elements/ui_panel.py
index 9394f81..dcd216c 100644
--- a/pygame_gui/elements/ui_panel.py
+++ b/pygame_gui/elements/ui_panel.py
@@ -23,7 +23,7 @@ class UIPanel(UIElement, IContainerLikeInterface):
 
     :param relative_rect: The positioning and sizing rectangle for the panel. See the layout
                           guide for details.
-    :param starting_layer_height: How many layers above its container to place this panel on.
+    :param starting_height: How many layers above its container to place this panel on.
     :param manager: The GUI manager that handles drawing and updating the UI and interactions
                     between elements. If not provided or set to None,
                     it will try to use the first UIManager that was created by your application.
@@ -42,7 +42,7 @@ class UIPanel(UIElement, IContainerLikeInterface):
     """
     def __init__(self,
                  relative_rect: pygame.Rect,
-                 starting_layer_height: int = 1,
+                 starting_height: int = 1,
                  manager: Optional[IUIManagerInterface] = None,
                  *,
                  element_id: str = 'panel',
@@ -57,7 +57,7 @@ class UIPanel(UIElement, IContainerLikeInterface):
         super().__init__(relative_rect,
                          manager,
                          container,
-                         starting_height=starting_layer_height,
+                         starting_height=starting_height,
                          layer_thickness=1,
                          anchors=anchors,
                          visible=visible)
@@ -93,7 +93,7 @@ class UIPanel(UIElement, IContainerLikeInterface):
                                                                   self.container_margins['bottom']))
 
         self.panel_container = UIContainer(container_rect, manager,
-                                           starting_height=starting_layer_height,
+                                           starting_height=starting_height,
                                            container=container,
                                            parent_element=self,
                                            object_id=ObjectID(object_id='#panel_container',
diff --git a/pygame_gui/elements/ui_text_box.py b/pygame_gui/elements/ui_text_box.py
index d514d00..afcdf43 100644
--- a/pygame_gui/elements/ui_text_box.py
+++ b/pygame_gui/elements/ui_text_box.py
@@ -67,7 +67,7 @@ class UITextBox(UIElement, IUITextOwnerInterface):
                     it will try to use the first UIManager that was created by your application.
     :param wrap_to_height: False by default, if set to True the box will increase in height to
                            match the text within.
-    :param layer_starting_height: Sets the height, above its container, to start placing the text
+    :param starting_height: Sets the height, above its container, to start placing the text
                                   box at.
     :param container: The container that this element is within. If not provided or set to None
                       will be the root window's container.
@@ -86,7 +86,7 @@ class UITextBox(UIElement, IUITextOwnerInterface):
                  relative_rect: Union[pygame.Rect, Tuple[int, int, int, int]],
                  manager: Optional[IUIManagerInterface] = None,
                  wrap_to_height: bool = False,
-                 layer_starting_height: int = 1,
+                 starting_height: int = 1,
                  container: Optional[IContainerLikeInterface] = None,
                  parent_element: Optional[UIElement] = None,
                  object_id: Optional[Union[ObjectID, str]] = None,
@@ -100,7 +100,7 @@ class UITextBox(UIElement, IUITextOwnerInterface):
                  should_html_unescape_input_text: bool = False):
 
         super().__init__(relative_rect, manager, container,
-                         starting_height=layer_starting_height,
+                         starting_height=starting_height,
                          layer_thickness=2,
                          anchors=anchors,
                          visible=visible
@@ -587,7 +587,7 @@ class UITextBox(UIElement, IUITextOwnerInterface):
         """
         if self.rect.width <= 0 or self.rect.height <= 0:
             return
-        if (self.scroll_bar is None and
+        if (self.scroll_bar is None and (self.text_wrap_rect[3] != -1) and
                 (self.text_box_layout.layout_rect.height > self.text_wrap_rect[3])):
             self.rebuild()
         else:
diff --git a/pygame_gui/elements/ui_tool_tip.py b/pygame_gui/elements/ui_tool_tip.py
index e2464b5..714d772 100644
--- a/pygame_gui/elements/ui_tool_tip.py
+++ b/pygame_gui/elements/ui_tool_tip.py
@@ -66,7 +66,7 @@ class UITooltip(UIElement, IUITooltipInterface):
         self.text_block = UITextBox(html_text,
                                     pygame.Rect(0, 0, self.rect_width, -1),
                                     manager=self.ui_manager,
-                                    layer_starting_height=self._layer,
+                                    starting_height=self._layer,
                                     parent_element=self,
                                     text_kwargs=text_kwargs)
 
diff --git a/tests/test_elements/test_ui_panel.py b/tests/test_elements/test_ui_panel.py
index 89ec1ce..2fdbc37 100644
--- a/tests/test_elements/test_ui_panel.py
+++ b/tests/test_elements/test_ui_panel.py
@@ -15,12 +15,12 @@ class TestUIPanel:
 
     def test_creation(self, _init_pygame, _display_surface_return_none, default_ui_manager):
         UIPanel(relative_rect=pygame.Rect(50, 50, 150, 400),
-                starting_layer_height=5,
+                starting_height=5,
                 manager=default_ui_manager)
 
     def test_creation_with_margins(self, _init_pygame, _display_surface_return_none, default_ui_manager):
         UIPanel(relative_rect=pygame.Rect(50, 50, 150, 400),
-                starting_layer_height=5,
+                starting_height=5,
                 manager=default_ui_manager,
                 margins={'left': 10,
                          'right': 10,
@@ -29,7 +29,7 @@ class TestUIPanel:
 
     def test_update(self, _init_pygame, _display_surface_return_none, default_ui_manager):
         panel = UIPanel(relative_rect=pygame.Rect(50, 50, 150, 400),
-                        starting_layer_height=5,
+                        starting_height=5,
                         manager=default_ui_manager,
                         margins={'left': 10,
                                  'right': 10,
@@ -45,7 +45,7 @@ class TestUIPanel:
 
     def test_add_button(self, _init_pygame, _display_surface_return_none, default_ui_manager):
         panel = UIPanel(relative_rect=pygame.Rect(50, 50, 150, 400),
-                        starting_layer_height=5,
+                        starting_height=5,
                         manager=default_ui_manager,
                         margins={'left': 10,
                                  'right': 10,
@@ -68,7 +68,7 @@ class TestUIPanel:
 
     def test_process_event(self, _init_pygame, _display_surface_return_none, default_ui_manager):
         panel = UIPanel(relative_rect=pygame.Rect(50, 50, 150, 400),
-                        starting_layer_height=5,
+                        starting_height=5,
                         manager=default_ui_manager,
                         margins={'left': 10,
                                  'right': 10,
@@ -91,7 +91,7 @@ class TestUIPanel:
 
     def test_kill(self, _init_pygame, _display_surface_return_none, default_ui_manager: IUIManagerInterface):
         panel = UIPanel(relative_rect=pygame.Rect(50, 50, 150, 400),
-                        starting_layer_height=5,
+                        starting_height=5,
                         manager=default_ui_manager,
                         margins={'left': 10,
                                  'right': 10,
@@ -123,7 +123,7 @@ class TestUIPanel:
         element_1 = UIPanel(relative_rect=pygame.Rect(0, 0, 50, 50),
                             manager=default_ui_manager,
                             container=test_container,
-                            starting_layer_height=5,
+                            starting_height=5,
                             anchors={'left': 'left',
                                      'right': 'left',
                                      'top': 'top',
@@ -137,7 +137,7 @@ class TestUIPanel:
         element_2 = UIPanel(relative_rect=pygame.Rect(0, 0, 50, 50),
                             manager=default_ui_manager,
                             container=test_container,
-                            starting_layer_height=5,
+                            starting_height=5,
                             anchors={'left': 'right',
                                      'right': 'right',
                                      'top': 'top',
@@ -151,7 +151,7 @@ class TestUIPanel:
         element_3 = UIPanel(relative_rect=pygame.Rect(0, 0, 50, 50),
                             manager=default_ui_manager,
                             container=test_container,
-                            starting_layer_height=5,
+                            starting_height=5,
                             anchors={'left': 'right',
                                      'right': 'right',
                                      'top': 'bottom',
@@ -165,7 +165,7 @@ class TestUIPanel:
         element_4 = UIPanel(relative_rect=pygame.Rect(0, 0, 50, 50),
                             manager=default_ui_manager,
                             container=test_container,
-                            starting_layer_height=5,
+                            starting_height=5,
                             anchors={'left': 'left',
                                      'right': 'left',
                                      'top': 'bottom',
@@ -179,7 +179,7 @@ class TestUIPanel:
         element_5 = UIPanel(relative_rect=pygame.Rect(0, 0, 50, 50),
                             manager=default_ui_manager,
                             container=test_container,
-                            starting_layer_height=5,
+                            starting_height=5,
                             anchors={'left': 'left',
                                      'right': 'right',
                                      'top': 'top',
@@ -201,7 +201,7 @@ class TestUIPanel:
         element = UIPanel(relative_rect=pygame.Rect(100, 100, 50, 50),
                           manager=default_ui_manager,
                           container=test_container,
-                          starting_layer_height=5)
+                          starting_height=5)
 
         element.set_position((150, 30))
 
@@ -210,7 +210,7 @@ class TestUIPanel:
         element_1 = UIPanel(relative_rect=pygame.Rect(0, 0, 50, 50),
                             manager=default_ui_manager,
                             container=test_container,
-                            starting_layer_height=5,
+                            starting_height=5,
                             anchors={'left': 'left',
                                      'right': 'left',
                                      'top': 'top',
@@ -224,7 +224,7 @@ class TestUIPanel:
         element_2 = UIPanel(relative_rect=pygame.Rect(0, 0, 50, 50),
                             manager=default_ui_manager,
                             container=test_container,
-                            starting_layer_height=5,
+                            starting_height=5,
                             anchors={'left': 'right',
                                      'right': 'right',
                                      'top': 'top',
@@ -238,7 +238,7 @@ class TestUIPanel:
         element_3 = UIPanel(relative_rect=pygame.Rect(0, 0, 50, 50),
                             manager=default_ui_manager,
                             container=test_container,
-                            starting_layer_height=5,
+                            starting_height=5,
                             anchors={'left': 'right',
                                      'right': 'right',
                                      'top': 'bottom',
@@ -252,7 +252,7 @@ class TestUIPanel:
         element_4 = UIPanel(relative_rect=pygame.Rect(0, 0, 50, 50),
                             manager=default_ui_manager,
                             container=test_container,
-                            starting_layer_height=5,
+                            starting_height=5,
                             anchors={'left': 'left',
                                      'right': 'left',
                                      'top': 'bottom',
@@ -266,7 +266,7 @@ class TestUIPanel:
         element_5 = UIPanel(relative_rect=pygame.Rect(0, 0, 50, 50),
                             manager=default_ui_manager,
                             container=test_container,
-                            starting_layer_height=5,
+                            starting_height=5,
                             anchors={'left': 'left',
                                      'right': 'right',
                                      'top': 'top',
@@ -289,7 +289,7 @@ class TestUIPanel:
         element_1 = UIPanel(relative_rect=pygame.Rect(30, 30, 50, 50),
                             manager=default_ui_manager,
                             container=test_container,
-                            starting_layer_height=5,
+                            starting_height=5,
                             anchors={'left': 'left',
                                      'right': 'left',
                                      'top': 'top',
@@ -310,7 +310,7 @@ class TestUIPanel:
         element_2 = UIPanel(relative_rect=pygame.Rect(-60, 10, 50, 50),
                             manager=default_ui_manager,
                             container=test_container,
-                            starting_layer_height=5,
+                            starting_height=5,
                             anchors={'left': 'right',
                                      'right': 'right',
                                      'top': 'top',
@@ -331,7 +331,7 @@ class TestUIPanel:
         element_3 = UIPanel(relative_rect=pygame.Rect(-70, -70, 50, 50),
                             manager=default_ui_manager,
                             container=test_container,
-                            starting_layer_height=5,
+                            starting_height=5,
                             anchors={'left': 'right',
                                      'right': 'right',
                                      'top': 'bottom',
@@ -352,7 +352,7 @@ class TestUIPanel:
         element_4 = UIPanel(relative_rect=pygame.Rect(50, -50, 50, 50),
                             manager=default_ui_manager,
                             container=test_container,
-                            starting_layer_height=5,
+                            starting_height=5,
                             anchors={'left': 'left',
                                      'right': 'left',
                                      'top': 'bottom',
@@ -374,7 +374,7 @@ class TestUIPanel:
         element_5 = UIPanel(relative_rect=pygame.Rect(10, 10, 50, 50),
                             manager=default_ui_manager,
                             container=test_container,
-                            starting_layer_height=5,
+                            starting_height=5,
                             anchors={'left': 'left',
                                      'right': 'right',
                                      'top': 'top',
@@ -416,7 +416,7 @@ class TestUIPanel:
         manager = UIManager((800, 600), os.path.join("tests", "data",
                                                      "themes", "ui_panel_non_default.json"))
         panel = UIPanel(relative_rect=pygame.Rect(50, 50, 150, 400),
-                        starting_layer_height=5,
+                        starting_height=5,
                         manager=manager,
                         margins={'left': 10,
                                  'right': 10,
@@ -435,7 +435,7 @@ class TestUIPanel:
         manager = UIManager((800, 600), os.path.join("tests", "data", "themes",
                                                      "ui_panel_bad_values.json"))
         panel = UIPanel(relative_rect=pygame.Rect(50, 50, 150, 400),
-                        starting_layer_height=5,
+                        starting_height=5,
                         manager=manager,
                         margins={'left': 10,
                                  'right': 10,
@@ -447,7 +447,7 @@ class TestUIPanel:
     def test_disable(self, _init_pygame: None, default_ui_manager: UIManager,
                      _display_surface_return_none: None):
         panel = UIPanel(relative_rect=pygame.Rect(0, 0, 150, 400),
-                        starting_layer_height=5,
+                        starting_height=5,
                         manager=default_ui_manager)
         button_1 = UIButton(relative_rect=pygame.Rect(10, 10, 150, 30),
                             text="Test Button",
@@ -481,7 +481,7 @@ class TestUIPanel:
     def test_enable(self, _init_pygame: None, default_ui_manager: UIManager,
                     _display_surface_return_none: None):
         panel = UIPanel(relative_rect=pygame.Rect(0, 0, 150, 400),
-                        starting_layer_height=5,
+                        starting_height=5,
                         manager=default_ui_manager)
         button_1 = UIButton(relative_rect=pygame.Rect(10, 10, 150, 30),
                             text="Test Button",
@@ -515,7 +515,7 @@ class TestUIPanel:
 
     def test_panel_children_inheriting_hidden_status(self, _init_pygame, default_ui_manager: IUIManagerInterface,
                                                      _display_surface_return_none):
-        panel = UIPanel(pygame.Rect(100, 100, 200, 200), manager=default_ui_manager, visible=0, starting_layer_height=5)
+        panel = UIPanel(pygame.Rect(100, 100, 200, 200), manager=default_ui_manager, visible=0, starting_height=5)
         button = UIButton(relative_rect=pygame.Rect(0, 0, 50, 50), text="",
                           manager=default_ui_manager, container=panel, visible=1)
         assert panel.visible == 0
@@ -523,7 +523,7 @@ class TestUIPanel:
 
     def test_hidden_panel_children_behaviour_on_show(self, _init_pygame, default_ui_manager: IUIManagerInterface,
                                                      _display_surface_return_none):
-        panel = UIPanel(pygame.Rect(100, 100, 200, 200), manager=default_ui_manager, visible=0, starting_layer_height=5)
+        panel = UIPanel(pygame.Rect(100, 100, 200, 200), manager=default_ui_manager, visible=0, starting_height=5)
         button = UIButton(relative_rect=pygame.Rect(0, 0, 50, 50), text="",
                           manager=default_ui_manager, container=panel)
         assert panel.visible == 0
@@ -536,7 +536,7 @@ class TestUIPanel:
                                                       default_ui_manager: IUIManagerInterface,
                                                       _display_surface_return_none):
         panel = UIPanel(pygame.Rect(100, 100, 200, 200), manager=default_ui_manager,
-                        visible=1, starting_layer_height=5)
+                        visible=1, starting_height=5)
         button = UIButton(relative_rect=pygame.Rect(0, 0, 50, 50), text="",
                           manager=default_ui_manager, container=panel, visible=0)
         assert panel.visible == 1
@@ -549,7 +549,7 @@ class TestUIPanel:
                                                       default_ui_manager: IUIManagerInterface,
                                                       _display_surface_return_none):
         panel = UIPanel(pygame.Rect(100, 100, 200, 200), manager=default_ui_manager,
-                        visible=1, starting_layer_height=5)
+                        visible=1, starting_height=5)
         button = UIButton(relative_rect=pygame.Rect(0, 0, 50, 50), text="",
                           manager=default_ui_manager, container=panel)
         assert panel.visible == 1
@@ -562,7 +562,7 @@ class TestUIPanel:
                                                      default_ui_manager: IUIManagerInterface,
                                                      _display_surface_return_none):
         panel = UIPanel(pygame.Rect(100, 100, 200, 200), manager=default_ui_manager,
-                        visible=0, starting_layer_height=5)
+                        visible=0, starting_height=5)
         button = UIButton(relative_rect=pygame.Rect(0, 0, 50, 50), text="",
                           manager=default_ui_manager, container=panel)
         button.show()
@@ -580,7 +580,7 @@ class TestUIPanel:
         surface = empty_surface.copy()
         manager = UIManager(resolution)
 
-        panel = UIPanel(pygame.Rect(25, 25, 375, 150), manager=manager, visible=0, starting_layer_height=1)
+        panel = UIPanel(pygame.Rect(25, 25, 375, 150), manager=manager, visible=0, starting_height=1)
         UIButton(relative_rect=pygame.Rect(0, 0, 50, 50), text="",
                  manager=manager, container=panel)
 
diff --git a/tests/test_elements/test_ui_text_box.py b/tests/test_elements/test_ui_text_box.py
index 7319519..943d9bd 100644
--- a/tests/test_elements/test_ui_text_box.py
+++ b/tests/test_elements/test_ui_text_box.py
@@ -675,7 +675,7 @@ class TestUITextBox:
                              relative_rect=rect,
                              manager=default_ui_manager,
                              wrap_to_height=True,
-                             layer_starting_height=100,
+                             starting_height=100,
                              object_id="screen_message")
 
         assert text_box.rect.height != 10
@@ -692,7 +692,7 @@ class TestUITextBox:
                              relative_rect=rect,
                              manager=default_ui_manager,
                              wrap_to_height=True,
-                             layer_starting_height=100,
+                             starting_height=100,
                              object_id="screen_message")
 
         assert text_box.rect.height != 0
@@ -775,7 +775,7 @@ class TestUITextBox:
                              relative_rect=rect,
                              manager=default_ui_manager,
                              wrap_to_height=False,
-                             layer_starting_height=100,
+                             starting_height=100,
                              object_id="screen_message",
                              visible=0)
 
@@ -802,7 +802,7 @@ class TestUITextBox:
                              relative_rect=rect,
                              manager=default_ui_manager,
                              wrap_to_height=False,
-                             layer_starting_height=100,
+                             starting_height=100,
                              object_id="screen_message",
                              visible=0)
 
@@ -837,7 +837,7 @@ class TestUITextBox:
                              relative_rect=rect,
                              manager=default_ui_manager,
                              wrap_to_height=False,
-                             layer_starting_height=100,
+                             starting_height=100,
                              object_id="screen_message")
 
         assert text_box.visible == 1
@@ -863,7 +863,7 @@ class TestUITextBox:
                              relative_rect=rect,
                              manager=default_ui_manager,
                              wrap_to_height=False,
-                             layer_starting_height=100,
+                             starting_height=100,
                              object_id="screen_message")
 
         assert text_box.visible == 1
@@ -895,7 +895,7 @@ class TestUITextBox:
                              relative_rect=pygame.Rect(100, 100, 400, 400),
                              manager=manager,
                              wrap_to_height=False,
-                             layer_starting_height=100,
+                             starting_height=100,
                              object_id="screen_message",
                              visible=0)
         manager.update(0.01)