mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
fix error in CTkFont with multiple destroy calls #1692
This commit is contained in:
parent
37b375d58b
commit
abe33f7e81
@ -186,7 +186,7 @@ class CTkSegmentedButton(CTkFrame):
|
|||||||
|
|
||||||
for index, value in enumerate(self._value_list):
|
for index, value in enumerate(self._value_list):
|
||||||
self.grid_columnconfigure(index, weight=1, minsize=self._current_height)
|
self.grid_columnconfigure(index, weight=1, minsize=self._current_height)
|
||||||
self._buttons_dict[value].grid(row=0, column=index, sticky="ew")
|
self._buttons_dict[value].grid(row=0, column=index, sticky="nsew")
|
||||||
|
|
||||||
def _create_buttons_from_values(self):
|
def _create_buttons_from_values(self):
|
||||||
assert len(self._buttons_dict) == 0
|
assert len(self._buttons_dict) == 0
|
||||||
|
@ -171,9 +171,10 @@ class CTkTabview(CTkBaseClass):
|
|||||||
padx=self._apply_widget_scaling(max(self._corner_radius, self._border_width)),
|
padx=self._apply_widget_scaling(max(self._corner_radius, self._border_width)),
|
||||||
pady=self._apply_widget_scaling(max(self._corner_radius, self._border_width)))
|
pady=self._apply_widget_scaling(max(self._corner_radius, self._border_width)))
|
||||||
|
|
||||||
def _grid_forget_all_tabs(self):
|
def _grid_forget_all_tabs(self, exclude_name=None):
|
||||||
for frame in self._tab_dict.values():
|
for name, frame in self._tab_dict.items():
|
||||||
frame.grid_forget()
|
if name != exclude_name:
|
||||||
|
frame.grid_forget()
|
||||||
|
|
||||||
def _create_tab(self) -> CTkFrame:
|
def _create_tab(self) -> CTkFrame:
|
||||||
new_tab = CTkFrame(self,
|
new_tab = CTkFrame(self,
|
||||||
@ -360,8 +361,8 @@ class CTkTabview(CTkBaseClass):
|
|||||||
if name in self._tab_dict:
|
if name in self._tab_dict:
|
||||||
self._current_name = name
|
self._current_name = name
|
||||||
self._segmented_button.set(name)
|
self._segmented_button.set(name)
|
||||||
self._grid_forget_all_tabs()
|
|
||||||
self._set_grid_tab_by_name(name)
|
self._set_grid_tab_by_name(name)
|
||||||
|
self.after(100, lambda: self._grid_forget_all_tabs(exclude_name=name))
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"CTkTabview has no tab named '{name}'")
|
raise ValueError(f"CTkTabview has no tab named '{name}'")
|
||||||
|
|
||||||
|
@ -52,7 +52,10 @@ class CTkFont(Font):
|
|||||||
|
|
||||||
def remove_size_configure_callback(self, callback: Callable):
|
def remove_size_configure_callback(self, callback: Callable):
|
||||||
""" remove function, that gets called when font got configured """
|
""" remove function, that gets called when font got configured """
|
||||||
self._size_configure_callback_list.remove(callback)
|
try:
|
||||||
|
self._size_configure_callback_list.remove(callback)
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
def create_scaled_tuple(self, font_scaling: float) -> Tuple[str, int, str]:
|
def create_scaled_tuple(self, font_scaling: float) -> Tuple[str, int, str]:
|
||||||
""" return scaled tuple representation of font in the form (family: str, size: int, style: str)"""
|
""" return scaled tuple representation of font in the form (family: str, size: int, style: str)"""
|
||||||
|
Loading…
Reference in New Issue
Block a user