@@ -223,6 +223,7 @@ def __init__(
223223 selection_option_font : FontType | None = None ,
224224 selection_option_font_color : ColorInputType = (0 , 0 , 0 ),
225225 selection_option_font_size : int | None = None ,
226+ selection_option_left_space : bool = False ,
226227 selection_option_left_space_height_factor : float = 1.0 ,
227228 selection_option_padding : PaddingType = 5 ,
228229 selection_option_selected_bgcolor : ColorInputType = (188 , 227 , 244 ),
@@ -328,7 +329,7 @@ def __init__(
328329
329330 # If True adds a space equals to the height of the option at left, used for
330331 # drawing some options (for example, ticks, boxes, etc.)
331- self ._selection_option_left_space = False
332+ self ._selection_option_left_space = selection_option_left_space
332333 self ._selection_option_left_space_height_factor = (
333334 selection_option_left_space_height_factor
334335 )
@@ -1089,7 +1090,7 @@ def _up(self) -> None:
10891090 self ._sound .play_key_add ()
10901091 return None
10911092
1092- def set_value (self , item : str | int ) -> None :
1093+ def set_value (self , item : str | int , process_index : bool = False ) -> None :
10931094 """
10941095 Set the current value of the widget, selecting the item that matches the
10951096 text if ``item`` is a string, or the index if ``item`` is an integer.
@@ -1104,10 +1105,9 @@ def set_value(self, item: str | int) -> None:
11041105
11051106 This method does not trigger any event (change).
11061107
1107- :param item: Item to select, can be a string or an integer
1108+ :param item: The item to select, either a string or an integer index.
1109+ :param process_index: Ignored in this class; used by subclasses.
11081110 """
1109- assert isinstance (item , (str , int )), "item must be a string or an integer"
1110-
11111111 if isinstance (item , str ):
11121112 found = False
11131113 for i in self ._items :
@@ -1117,13 +1117,17 @@ def set_value(self, item: str | int) -> None:
11171117 break
11181118 if not found :
11191119 raise ValueError (f'no value "{ item } " found in drop select' )
1120+
11201121 elif isinstance (item , int ):
11211122 assert - 1 <= item < len (self ._items ), (
11221123 "item index must be greater than zero and lower than the number "
11231124 "of items on the drop select"
11241125 )
11251126 self ._index = item
11261127
1128+ # Base class ignores process_index
1129+ # (DropSelectMultiple overrides and uses it)
1130+
11271131 # Update options background selection
11281132 for b_ind_x in range (len (self ._option_buttons )):
11291133 btn = self ._option_buttons [b_ind_x ]
0 commit comments