cget now returns copy of lists

This commit is contained in:
Tom Schimansky 2022-12-06 18:47:39 +01:00
parent 868b2a2f42
commit 7572f095c2
3 changed files with 6 additions and 3 deletions

View File

@ -1,5 +1,6 @@
import tkinter import tkinter
import sys import sys
import copy
from typing import Union, Tuple, Callable, List, Optional from typing import Union, Tuple, Callable, List, Optional
from .core_widget_classes import DropdownMenu from .core_widget_classes import DropdownMenu
@ -324,7 +325,7 @@ class CTkComboBox(CTkBaseClass):
elif attribute_name == "dropdown_font": elif attribute_name == "dropdown_font":
return self._dropdown_menu.cget("font") return self._dropdown_menu.cget("font")
elif attribute_name == "values": elif attribute_name == "values":
return self._values return copy.copy(self._values)
elif attribute_name == "state": elif attribute_name == "state":
return self._state return self._state
elif attribute_name == "hover": elif attribute_name == "hover":

View File

@ -1,4 +1,5 @@
import tkinter import tkinter
import copy
import sys import sys
from typing import Union, Tuple, Callable, Optional from typing import Union, Tuple, Callable, Optional
@ -328,7 +329,7 @@ class CTkOptionMenu(CTkBaseClass):
elif attribute_name == "dropdown_font": elif attribute_name == "dropdown_font":
return self._dropdown_menu.cget("font") return self._dropdown_menu.cget("font")
elif attribute_name == "values": elif attribute_name == "values":
return self._values return copy.copy(self._values)
elif attribute_name == "variable": elif attribute_name == "variable":
return self._variable return self._variable
elif attribute_name == "state": elif attribute_name == "state":

View File

@ -1,4 +1,5 @@
import tkinter import tkinter
import copy
from typing import Union, Tuple, List, Dict, Callable, Optional from typing import Union, Tuple, List, Dict, Callable, Optional
try: try:
from typing import Literal from typing import Literal
@ -321,7 +322,7 @@ class CTkSegmentedButton(CTkFrame):
elif attribute_name == "font": elif attribute_name == "font":
return self._font return self._font
elif attribute_name == "values": elif attribute_name == "values":
return self._value_list return copy.copy(self._value_list)
elif attribute_name == "variable": elif attribute_name == "variable":
return self._variable return self._variable
elif attribute_name == "dynamic_resizing": elif attribute_name == "dynamic_resizing":