mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
added fix for empty value for segmented button
This commit is contained in:
parent
cf62427f66
commit
779434dc29
|
@ -357,6 +357,7 @@ class CTkSegmentedButton(CTkFrame):
|
||||||
|
|
||||||
def insert(self, index: int, value: str):
|
def insert(self, index: int, value: str):
|
||||||
if value not in self._buttons_dict:
|
if value not in self._buttons_dict:
|
||||||
|
if value != "":
|
||||||
self._value_list.insert(index, value)
|
self._value_list.insert(index, value)
|
||||||
self._buttons_dict[value] = self._create_button(index, value)
|
self._buttons_dict[value] = self._create_button(index, value)
|
||||||
|
|
||||||
|
@ -370,6 +371,8 @@ class CTkSegmentedButton(CTkFrame):
|
||||||
|
|
||||||
if value == self._current_value:
|
if value == self._current_value:
|
||||||
self._select_button_by_value(self._current_value)
|
self._select_button_by_value(self._current_value)
|
||||||
|
else:
|
||||||
|
raise ValueError(f"CTkSegmentedButton can not insert value ''")
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"CTkSegmentedButton can not insert value '{value}', already part of the values")
|
raise ValueError(f"CTkSegmentedButton can not insert value '{value}', already part of the values")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user