name support for CTkEntry, CTkLabel, CTkTextbox

This commit is contained in:
jericjan 2022-08-29 13:07:03 +08:00 committed by GitHub
parent f39ee5764a
commit b04ff1ae6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 14 deletions

View File

@ -24,10 +24,12 @@ class CTkEntry(CTkBaseClass):
**kwargs):
# transfer basic functionality (bg_color, size, _appearance_mode, scaling) to CTkBaseClass
super_kwargs = {}
if "master" in kwargs:
super().__init__(*args, bg_color=bg_color, width=width, height=height, master=kwargs.pop("master"))
else:
super().__init__(*args, bg_color=bg_color, width=width, height=height)
super_kwargs['master'] = kwargs.pop("master")
if "name" in kwargs:
super_kwargs['name'] = kwargs.pop("name")
super().__init__(*args, bg_color=bg_color, width=width, height=height,**super_kwargs)
# configure grid system (1x1)
self.grid_rowconfigure(0, weight=1)

View File

@ -21,11 +21,12 @@ class CTkLabel(CTkBaseClass):
**kwargs):
# transfer basic functionality (bg_color, size, _appearance_mode, scaling) to CTkBaseClass
super_kwargs = {}
if "master" in kwargs:
super().__init__(*args, bg_color=bg_color, width=width, height=height, master=kwargs.pop("master"))
else:
super().__init__(*args, bg_color=bg_color, width=width, height=height)
super_kwargs['master'] = kwargs.pop("master")
if "name" in kwargs:
super_kwargs['name'] = kwargs.pop("name")
super().__init__(*args, bg_color=bg_color, width=width, height=height,**super_kwargs)
# color
self.fg_color = ThemeManager.theme["color"]["label"] if fg_color == "default_theme" else fg_color
if self.fg_color is None:

View File

@ -20,10 +20,12 @@ class CTkTextbox(CTkBaseClass):
**kwargs):
# transfer basic functionality (bg_color, size, _appearance_mode, scaling) to CTkBaseClass
super_kwargs = {}
if "master" in kwargs:
super().__init__(*args, bg_color=bg_color, width=width, height=height, master=kwargs.pop("master"))
else:
super().__init__(*args, bg_color=bg_color, width=width, height=height)
super_kwargs['master'] = kwargs.pop("master")
if "name" in kwargs:
super_kwargs['name'] = kwargs.pop("name")
super().__init__(*args, bg_color=bg_color, width=width, height=height,**super_kwargs)
# color
self.fg_color = ThemeManager.theme["color"]["entry"] if fg_color == "default_theme" else fg_color