Repository: MyreMylar/pygame_gui
Pull request #286 (2022-08-02 08:12:15)

Improve test coverage for UI Label
Also features:
- a minor bug fix/param name correction for fade in effect. 
- More lazy anchor declaration for all elements. Default values for each anchor will be used if no anchor is specified.


Patch:
diff --git a/pygame_gui/core/text/text_effects.py b/pygame_gui/core/text/text_effects.py
index 1f7a95c..70053d3 100644
--- a/pygame_gui/core/text/text_effects.py
+++ b/pygame_gui/core/text/text_effects.py
@@ -131,11 +131,11 @@ class FadeInEffect(TextEffect):
     care of fading up an alpha value over time.
 
     """
-    def __init__(self, text_box: IUITextOwnerInterface,
+    def __init__(self, text_owner: IUITextOwnerInterface,
                  params: Optional[Dict[str, Any]] = None,
                  text_sub_chunk: Optional[TextLineChunkFTFont] = None):
         super().__init__()
-        self.text_owner = text_box
+        self.text_owner = text_owner
         self.text_sub_chunk = text_sub_chunk
         self.alpha_value = 0
         self.time_per_alpha_change = 0.01
diff --git a/pygame_gui/core/ui_element.py b/pygame_gui/core/ui_element.py
index ab02198..2615b6d 100644
--- a/pygame_gui/core/ui_element.py
+++ b/pygame_gui/core/ui_element.py
@@ -65,12 +65,29 @@ class UIElement(GUISprite, IUIElementInterface):
         self.combined_element_ids = None
         self.most_specific_combined_id = 'no_id'
 
-        self.anchors = anchors
-        if self.anchors is None:
-            self.anchors = {'left': 'left',
-                            'top': 'top',
-                            'right': 'left',
-                            'bottom': 'top'}
+        self.anchors = {'left': 'left',
+                        'top': 'top',
+                        'right': 'left',
+                        'bottom': 'top'}
+        if anchors is not None:
+            if 'left' in anchors:
+                self.anchors['left'] = anchors['left']
+            if 'right' in anchors:
+                self.anchors['right'] = anchors['right']
+            if 'top' in anchors:
+                self.anchors['top'] = anchors['top']
+            if 'bottom' in anchors:
+                self.anchors['bottom'] = anchors['bottom']
+
+            if 'left_target' in anchors:
+                self.anchors['left_target'] = anchors['left_target']
+            if 'right_target' in anchors:
+                self.anchors['right_target'] = anchors['right_target']
+            if 'top_target' in anchors:
+                self.anchors['top_target'] = anchors['top_target']
+            if 'bottom_target' in anchors:
+                self.anchors['bottom_target'] = anchors['bottom_target']
+
         self.drawable_shape = None  # type: Union['DrawableShape', None]
         self.image = None
 
diff --git a/pygame_gui/elements/ui_drop_down_menu.py b/pygame_gui/elements/ui_drop_down_menu.py
index a4e0ad4..f6ffe0b 100644
--- a/pygame_gui/elements/ui_drop_down_menu.py
+++ b/pygame_gui/elements/ui_drop_down_menu.py
@@ -694,39 +694,6 @@ class UIDropDownMenu(UIContainer):
         self.current_state = self.menu_states['closed']
         self.current_state.start(should_rebuild=True)
 
-    def add_options(self, new_options: List[str]) -> None:
-        """
-        Add new options to the drop down. Will close the drop down if it is currently open.
-
-        In many cases it may be easier just to recreate the drop down with whatever the new options list is.
-
-        :param new_options: The list of new options to add.
-        """
-        self.options_list.extend(new_options)
-        self.menu_states['expanded'].options_list = self.options_list
-
-        # if we have the dropdown open, close it so it can be reopened with the new options in place
-        self._close_dropdown_if_open()
-
-    def remove_options(self, options_to_remove: List[str]) -> None:
-        """
-        Will remove all instances of the options provided.
-
-        :param options_to_remove: The list of new options to remove.
-        """
-        self.options_list = [option for option in self.options_list if option not in options_to_remove]
-        self.menu_states['expanded'].options_list = self.options_list
-
-        # if we have the dropdown open, close it so it can be reopened with the new options in place
-        self._close_dropdown_if_open()
-
-    def _close_dropdown_if_open(self):
-        if self.current_state == self.menu_states['expanded']:
-            self.current_state.finish()
-            self.current_state = self.menu_states['closed']
-            self.current_state.selected_option = self.selected_option
-            self.current_state.start()
-
     def kill(self):
         """
         Overrides the standard sprite kill to also properly kill/finish the current state of the
diff --git a/pygame_gui/elements/ui_label.py b/pygame_gui/elements/ui_label.py
index 2cd154b..e812c07 100644
--- a/pygame_gui/elements/ui_label.py
+++ b/pygame_gui/elements/ui_label.py
@@ -122,7 +122,7 @@ class UILabel(UIElement, IUITextOwnerInterface):
             height_overlap = self.relative_rect.height - text_size[1]
             warn_text = ('Label Rect is too small for text: '
                          '' + translate(self.text, **self.text_kwargs) + ' - size diff: ' + str((width_overlap,
-                                                                             height_overlap)))
+                                                                                                 height_overlap)))
             warnings.warn(warn_text, UserWarning)
 
         theming_parameters = {'normal_bg': self.bg_colour,
@@ -327,7 +327,7 @@ class UILabel(UIElement, IUITextOwnerInterface):
                           params: Optional[Dict[str, Any]] = None,
                           effect_tag: Optional[str] = None):
         if effect_tag is not None:
-            warnings.warn('UILabels do not support effect tags')
+            warnings.warn('UILabels do not support effect tags', category=UserWarning)
 
         if self.active_text_effect is not None:
             self.clear_all_active_effects()
@@ -344,9 +344,9 @@ class UILabel(UIElement, IUITextOwnerInterface):
                 effect = FadeOutEffect(self, params)
                 self.active_text_effect = effect
             else:
-                warnings.warn('Unsupported effect name: ' + str(effect_type) + ' for label')
+                warnings.warn('Unsupported effect name: ' + str(effect_type) + ' for label', category=UserWarning)
         else:
-            warnings.warn('Unsupported effect name: ' + str(effect_type) + ' for label')
+            warnings.warn('Unsupported effect name: ' + str(effect_type) + ' for label', category=UserWarning)
 
     def stop_finished_effect(self, sub_chunk: Optional[TextLineChunkFTFont] = None):
         self.active_text_effect = None
diff --git a/pygame_gui/elements/ui_selection_list.py b/pygame_gui/elements/ui_selection_list.py
index f47d9dd..20c07df 100644
--- a/pygame_gui/elements/ui_selection_list.py
+++ b/pygame_gui/elements/ui_selection_list.py
@@ -108,26 +108,6 @@ class UISelectionList(UIElement):
         if self._default_selection is not None:
             self.set_default_selection()
 
-    def add_items(self, new_items: Union[List[str], List[Tuple[str, str]]]) -> None:
-        """
-        Add any number of new items to the selection list. Uses the same format
-        as when the list is first created.
-
-        :param new_items: the list of new items to add
-        """
-        self._raw_item_list.extend(new_items)
-        self.set_item_list(self._raw_item_list)
-
-    def remove_items(self, items_to_remove: Union[List[str], List[Tuple[str, str]]]) -> None:
-        """
-        Will remove all instances of the items provided. The full tuple is required for items with a
-        display name and an object ID.
-
-        :param items_to_remove: The list of new options to remove.
-        """
-        self._raw_item_list = [item for item in self._raw_item_list if item not in items_to_remove]
-        self.set_item_list(self._raw_item_list)
-
     def get_single_selection(self) -> Union[str, None]:
         """
         Get the selected item in a list, if any. Only works if this is a single-selection list.
@@ -346,7 +326,7 @@ class UISelectionList(UIElement):
         :raise ValueError: Throw an exception if a list is used for the default for a
                            single-selection list, or if the default value(s) requested is/are not
                            present in the options list.
-
+        
         :raise TypeError: Throw an exception if anything other than a string or a (str, str) tuple
                           is encountered in the requested defaults.
 


Test patch:
diff --git a/tests/test_core/test_text/test_text_effects.py b/tests/test_core/test_text/test_text_effects.py
index e0be65f..9d4fc6e 100644
--- a/tests/test_core/test_text/test_text_effects.py
+++ b/tests/test_core/test_text/test_text_effects.py
@@ -7,6 +7,7 @@ from pygame_gui.core.text import TextLineChunkFTFont
 from pygame_gui.core.text.text_effects import BounceEffect, TiltEffect, ExpandContractEffect
 from pygame_gui.ui_manager import UIManager
 from pygame_gui.elements.ui_text_box import UITextBox
+from pygame_gui.elements.ui_label import UILabel
 from pygame_gui import TEXT_EFFECT_FADE_OUT, TEXT_EFFECT_FADE_IN, TEXT_EFFECT_TYPING_APPEAR
 from pygame_gui import TEXT_EFFECT_BOUNCE, TEXT_EFFECT_TILT, TEXT_EFFECT_EXPAND_CONTRACT
 from pygame_gui import UITextEffectType, UI_TEXT_EFFECT_FINISHED
@@ -20,6 +21,12 @@ class TestTypingAppearEffect:
 
         assert typing_effect.text_owner == text_box
 
+        label = UILabel(pygame.Rect((10, 10), (200, 100)), 'Hello world',
+                        default_ui_manager)
+        label_typing_effect = TypingAppearEffect(text_owner=label)
+
+        assert label_typing_effect.text_owner == label
+
     def test_update(self, _init_pygame, default_ui_manager: UIManager):
         text_box = UITextBox('hello <font color=#FF0000>this is a</font> test',
                              pygame.Rect((10, 10), (200, 100)),
@@ -35,7 +42,20 @@ class TestTypingAppearEffect:
 
         assert typing_effect.text_progress == 2
 
-    def test_has_text_block_changed(self, _init_pygame, default_ui_manager: UIManager):
+        label = UILabel(pygame.Rect((10, 10), (200, 100)), 'Hello world',
+                        default_ui_manager)
+        label_typing_effect = TypingAppearEffect(text_owner=label)
+
+        assert label_typing_effect.text_progress == 0
+
+        label_typing_effect.update(time_delta=0.06)
+        label_typing_effect.update(time_delta=0.06)
+        label_typing_effect.update(time_delta=0.06)
+        label_typing_effect.update(time_delta=0.06)
+
+        assert label_typing_effect.text_progress == 2
+
+    def test_has_text_changed(self, _init_pygame, default_ui_manager: UIManager):
         text_box = UITextBox('hello <font color=#FF0000>this is a</font> test',
                              pygame.Rect((10, 10), (200, 100)),
                              default_ui_manager)
@@ -48,7 +68,19 @@ class TestTypingAppearEffect:
 
         assert typing_effect.has_text_changed()
 
-    def test_params(self, _init_pygame, default_ui_manager: UIManager):
+        label = UILabel(pygame.Rect((10, 10), (200, 100)), 'Hello world',
+                        default_ui_manager)
+        label_typing_effect = TypingAppearEffect(text_owner=label)
+
+        assert not label_typing_effect.has_text_changed()
+
+        label_typing_effect.update(time_delta=0.06)
+        label_typing_effect.update(time_delta=0.06)
+
+        assert label_typing_effect.has_text_changed()
+
+    def test_set_active_effect_and_params(self, _init_pygame,
+                                          default_ui_manager: UIManager):
         text_box = UITextBox('<effect id=test>Hello world</effect>',
                              pygame.Rect((10, 10), (200, 100)),
                              default_ui_manager)
@@ -61,6 +93,27 @@ class TestTypingAppearEffect:
         assert isinstance(text_box.active_text_chunk_effects[0]['effect'],
                           TypingAppearEffect)
 
+        label = UILabel(pygame.Rect((10, 10), (200, 100)), 'Hello world',
+                        default_ui_manager)
+
+        label.set_active_effect(TEXT_EFFECT_TYPING_APPEAR,
+                                params={'time_per_letter': 3.0,
+                                        'time_per_letter_deviation': 1.0})
+
+        label.set_active_effect(None)
+
+        with pytest.warns(UserWarning, match='UILabels do not support effect tags'):
+            label.set_active_effect(TEXT_EFFECT_TYPING_APPEAR,
+                                    params={'time_per_letter': 3.0,
+                                            'time_per_letter_deviation': 1.0},
+                                    effect_tag='test')
+
+        with pytest.warns(UserWarning, match='Unsupported effect name'):
+            label.set_active_effect(TEXT_EFFECT_BOUNCE)
+
+        with pytest.warns(UserWarning, match='Unsupported effect name'):
+            label.set_active_effect("bunce")
+
     def test_finish_effect(self, _init_pygame, default_ui_manager: UIManager):
         text_box = UITextBox('<effect id=test>Hello world</effect>',
                              pygame.Rect((10, 10), (200, 100)),
@@ -84,16 +137,22 @@ class TestFadeInEffect:
     def test_creation(self, _init_pygame, default_ui_manager: UIManager):
         text_box = UITextBox('Hello world', pygame.Rect((10, 10), (200, 100)),
                              default_ui_manager)
-        fade_in_effect = FadeInEffect(text_box=text_box)
+        fade_in_effect = FadeInEffect(text_owner=text_box)
 
         assert fade_in_effect.text_owner == text_box
 
+        label = UILabel(pygame.Rect((10, 10), (200, 100)), 'Hello world',
+                        default_ui_manager)
+        label_fade_in_effect = FadeInEffect(text_owner=label)
+
+        assert label_fade_in_effect.text_owner == label
+
     def test_update(self, _init_pygame, default_ui_manager: UIManager):
         text_box = UITextBox('hello <font color=#FF0000>this is a</font> test',
                              pygame.Rect((10, 10), (200, 100)),
                              default_ui_manager)
 
-        fade_in_effect = FadeInEffect(text_box=text_box)
+        fade_in_effect = FadeInEffect(text_owner=text_box)
 
         assert fade_in_effect.alpha_value == 0
 
@@ -102,12 +161,23 @@ class TestFadeInEffect:
 
         assert fade_in_effect.alpha_value == (0.12 / fade_in_effect.time_per_alpha_change)
 
-    def test_has_text_block_changed(self, _init_pygame, default_ui_manager: UIManager):
+        label = UILabel(pygame.Rect((10, 10), (200, 100)), 'Hello world',
+                        default_ui_manager)
+        label_fade_in_effect = FadeInEffect(text_owner=label)
+
+        assert label_fade_in_effect.alpha_value == 0
+
+        label_fade_in_effect.update(time_delta=0.06)
+        label_fade_in_effect.update(time_delta=0.06)
+
+        assert label_fade_in_effect.alpha_value == (0.12 / label_fade_in_effect.time_per_alpha_change)
+
+    def test_has_text_changed(self, _init_pygame, default_ui_manager: UIManager):
         text_box = UITextBox('hello <font color=#FF0000>this is a</font> test',
                              pygame.Rect((10, 10), (200, 100)),
                              default_ui_manager)
 
-        fade_in_effect = FadeInEffect(text_box=text_box)
+        fade_in_effect = FadeInEffect(text_owner=text_box)
 
         assert not fade_in_effect.has_text_changed()
 
@@ -116,6 +186,17 @@ class TestFadeInEffect:
 
         assert fade_in_effect.has_text_changed()
 
+        label = UILabel(pygame.Rect((10, 10), (200, 100)), 'Hello world',
+                        default_ui_manager)
+        label_fade_in_effect = FadeInEffect(text_owner=label)
+
+        assert not label_fade_in_effect.has_text_changed()
+
+        label_fade_in_effect.update(time_delta=0.06)
+        label_fade_in_effect.update(time_delta=0.06)
+
+        assert label_fade_in_effect.has_text_changed()
+
     def test_params(self, _init_pygame, default_ui_manager: UIManager):
         text_box = UITextBox('<effect id=test>Hello world</effect>',
                              pygame.Rect((10, 10), (200, 100)),
@@ -127,6 +208,12 @@ class TestFadeInEffect:
 
         assert isinstance(text_box.active_text_chunk_effects[0]['effect'], FadeInEffect)
 
+        label = UILabel(pygame.Rect((10, 10), (200, 100)), 'Hello world',
+                        default_ui_manager)
+
+        label.set_active_effect(TEXT_EFFECT_FADE_IN,
+                                params={'time_per_alpha_change': 19.0})
+
     def test_finish_effect(self, _init_pygame, default_ui_manager: UIManager):
         text_box = UITextBox('<effect id=test>Hello world</effect>',
                              pygame.Rect((10, 10), (200, 100)),
@@ -154,6 +241,12 @@ class TestFadeOutEffect:
 
         assert fade_out_effect.text_owner == text_box
 
+        label = UILabel(pygame.Rect((10, 10), (200, 100)), 'Hello world',
+                        default_ui_manager)
+        label_fade_out_effect = FadeOutEffect(text_owner=label)
+
+        assert label_fade_out_effect.text_owner == label
+
     def test_update(self, _init_pygame, default_ui_manager: UIManager):
         text_box = UITextBox('hello <font color=#FF0000>this is a</font> test',
                              pygame.Rect((10, 10), (200, 100)),
@@ -168,6 +261,17 @@ class TestFadeOutEffect:
 
         assert fade_out_effect.alpha_value == 255 - (0.12 / fade_out_effect.time_per_alpha_change)
 
+        label = UILabel(pygame.Rect((10, 10), (200, 100)), 'Hello world',
+                        default_ui_manager)
+        label_fade_out_effect = FadeOutEffect(text_owner=label)
+
+        assert label_fade_out_effect.alpha_value == 255
+
+        label_fade_out_effect.update(time_delta=0.06)
+        label_fade_out_effect.update(time_delta=0.06)
+
+        assert label_fade_out_effect.alpha_value == 255 - (0.12 / label_fade_out_effect.time_per_alpha_change)
+
     def test_has_text_block_changed(self, _init_pygame, default_ui_manager: UIManager):
         text_box = UITextBox('hello <font color=#FF0000>this is a</font> test',
                              pygame.Rect((10, 10), (200, 100)),
@@ -193,6 +297,12 @@ class TestFadeOutEffect:
 
         assert isinstance(text_box.active_text_chunk_effects[0]['effect'], FadeOutEffect)
 
+        label = UILabel(pygame.Rect((10, 10), (200, 100)), 'Hello world',
+                        default_ui_manager)
+
+        label.set_active_effect(TEXT_EFFECT_FADE_OUT,
+                                params={'time_per_alpha_change': 19.0})
+
     def test_finish_effect(self, _init_pygame, default_ui_manager: UIManager):
         text_box = UITextBox('<effect id=test>Hello world</effect>',
                              pygame.Rect((10, 10), (200, 100)),
diff --git a/tests/test_elements/test_ui_drop_down_menu.py b/tests/test_elements/test_ui_drop_down_menu.py
index 162a5ef..2f9eb79 100644
--- a/tests/test_elements/test_ui_drop_down_menu.py
+++ b/tests/test_elements/test_ui_drop_down_menu.py
@@ -20,48 +20,6 @@ class TestUIDropDownMenu:
                               manager=default_ui_manager)
         assert menu.image is not None
 
-    def test_addition(self, _init_pygame, default_ui_manager,
-                      _display_surface_return_none):
-        menu = UIDropDownMenu(options_list=['eggs', 'flour', 'sugar'],
-                              starting_option='eggs',
-                              relative_rect=pygame.Rect(100, 100, 200, 30),
-                              manager=default_ui_manager)
-
-        menu.add_options(['spam', 'bad spam'])
-
-        assert menu.options_list[-1] == 'bad spam'
-
-        menu.current_state.should_transition = True
-        menu.update(0.01)
-
-        assert menu.current_state == menu.menu_states['expanded']
-
-        menu.add_options(['steak'])
-
-        assert menu.options_list[-1] == 'steak'
-        assert menu.current_state == menu.menu_states['closed']
-
-    def test_removal(self, _init_pygame, default_ui_manager,
-                     _display_surface_return_none):
-        menu = UIDropDownMenu(options_list=['cheese', 'eggs', 'flour', 'sugar'],
-                              starting_option='eggs',
-                              relative_rect=pygame.Rect(100, 100, 200, 30),
-                              manager=default_ui_manager)
-
-        menu.remove_options(['flour', 'sugar'])
-
-        assert menu.options_list[-1] == 'eggs'
-
-        menu.current_state.should_transition = True
-        menu.update(0.01)
-
-        assert menu.current_state == menu.menu_states['expanded']
-
-        menu.remove_options(['eggs'])
-
-        assert menu.options_list[-1] == 'cheese'
-        assert menu.current_state == menu.menu_states['closed']
-
     def test_kill(self, _init_pygame, default_ui_manager, _display_surface_return_none):
         menu = UIDropDownMenu(options_list=['eggs', 'flour', 'sugar'],
                               starting_option='eggs',
diff --git a/tests/test_elements/test_ui_label.py b/tests/test_elements/test_ui_label.py
index e788315..ee3c8fc 100644
--- a/tests/test_elements/test_ui_label.py
+++ b/tests/test_elements/test_ui_label.py
@@ -26,6 +26,14 @@ class TestUILabel:
         label.set_text("new text")
         assert label.image is not None
 
+    def test_kwargs_set_text(self, _init_pygame, default_ui_manager,
+                             _display_surface_return_none):
+        label = UILabel(relative_rect=pygame.Rect(100, 100, 150, 30),
+                        text="Test Label",
+                        manager=default_ui_manager)
+        label.set_text("Hello %{name}", name="Dan")
+        assert label.image is not None
+
     def test_rebuild(self, _init_pygame, default_ui_manager,
                      _display_surface_return_none):
         label = UILabel(relative_rect=pygame.Rect(100, 100, 150, 30),
@@ -34,6 +42,24 @@ class TestUILabel:
         label.rebuild()
         assert label.image is not None
 
+    def test_rebuild_anchors(self, _init_pygame, default_ui_manager,
+                             _display_surface_return_none):
+        label = UILabel(relative_rect=pygame.Rect(100, 100, -1, 30),
+                        text="Test Label",
+                        manager=default_ui_manager,
+                        anchors={"right": "right",
+                                 "left": "right"})
+        label.rebuild()
+        assert label.image is not None
+
+        label = UILabel(relative_rect=pygame.Rect(100, 100, 150, -1),
+                        text="Test Label",
+                        manager=default_ui_manager,
+                        anchors={"top": "bottom",
+                                 "bottom": "bottom"})
+        label.rebuild()
+        assert label.image is not None
+
     def test_rebuild_from_theme_data_non_default_1(self, _init_pygame):
         manager = UIManager((800, 600), os.path.join("tests", "data", "themes",
                                                      "ui_label_non_default_1.json"))
@@ -174,6 +200,21 @@ class TestUILabel:
         manager.draw_ui(surface)
         assert compare_surfaces(empty_surface, surface)
 
+    def test_change_locale(self, _init_pygame, default_ui_manager, _display_surface_return_none):
+        label = UILabel(pygame.Rect((10, 100), (150, 30)),
+                        'pygame-gui.English',
+                        default_ui_manager)
+        default_ui_manager.set_locale('fr')
+
+        assert label.drawable_shape.theming['text'] == "Anglaise"
+
+        label = UILabel(pygame.Rect((10, 100), (-1, -1)),
+                        'pygame-gui.English',
+                        default_ui_manager)
+        default_ui_manager.set_locale('ja')
+
+        assert label.drawable_shape.theming['text'] == "英語"
+
 
 if __name__ == '__main__':
     pytest.console_main()
diff --git a/tests/test_elements/test_ui_selection_list.py b/tests/test_elements/test_ui_selection_list.py
index b597f66..bcf05e3 100644
--- a/tests/test_elements/test_ui_selection_list.py
+++ b/tests/test_elements/test_ui_selection_list.py
@@ -19,26 +19,6 @@ class TestUISelectionList:
                         item_list=['green', 'eggs', 'and', 'ham'],
                         manager=default_ui_manager)
 
-    def test_addition(self, _init_pygame, default_ui_manager,
-                      _display_surface_return_none):
-        selection_list = UISelectionList(relative_rect=pygame.Rect(50, 50, 150, 400),
-                                         item_list=['green', 'eggs', 'and', 'ham'],
-                                         manager=default_ui_manager)
-
-        selection_list.add_items(['spam', ('bad spam', 'bad_spam')])
-
-        assert selection_list.item_list[-1]['text'] == 'bad spam'
-
-    def test_removal(self, _init_pygame, default_ui_manager,
-                     _display_surface_return_none):
-        selection_list = UISelectionList(relative_rect=pygame.Rect(50, 50, 150, 400),
-                                         item_list=['green', 'eggs', 'and', 'ham', ('bad spam', 'bad_spam')],
-                                         manager=default_ui_manager)
-
-        selection_list.remove_items(['ham', ('bad spam', 'bad_spam')])
-
-        assert selection_list.item_list[-1]['text'] == 'and'
-
     def test_get_single_selection(self, _init_pygame, default_ui_manager,
                                   _display_surface_return_none):
         selection_list = UISelectionList(relative_rect=pygame.Rect(50, 50, 150, 400),