mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
fixed bug in CTkLabel with multiline strings
This commit is contained in:
parent
36702326fa
commit
e295674e00
@ -119,7 +119,8 @@ class CTkLabel(CTkBaseClass):
|
|||||||
sticky=text_label_grid_sticky)
|
sticky=text_label_grid_sticky)
|
||||||
|
|
||||||
if "text" in kwargs:
|
if "text" in kwargs:
|
||||||
self.set_text(kwargs["text"])
|
self.text = kwargs["text"]
|
||||||
|
self.text_label.configure(text=self.text)
|
||||||
del kwargs["text"]
|
del kwargs["text"]
|
||||||
|
|
||||||
if "fg_color" in kwargs:
|
if "fg_color" in kwargs:
|
||||||
@ -148,5 +149,7 @@ class CTkLabel(CTkBaseClass):
|
|||||||
self.text_label.configure(**kwargs) # pass remaining kwargs to label
|
self.text_label.configure(**kwargs) # pass remaining kwargs to label
|
||||||
|
|
||||||
def set_text(self, text):
|
def set_text(self, text):
|
||||||
|
""" Will be removed in the next major release """
|
||||||
|
|
||||||
self.text = text
|
self.text = text
|
||||||
self.text_label.configure(text=self.text, width=len(self.text))
|
self.text_label.configure(text=self.text)
|
||||||
|
@ -37,7 +37,7 @@ class App(customtkinter.CTk):
|
|||||||
self.appearance_mode_optionemenu = customtkinter.CTkOptionMenu(self.sidebar_frame, values=["Light", "Dark", "System"],
|
self.appearance_mode_optionemenu = customtkinter.CTkOptionMenu(self.sidebar_frame, values=["Light", "Dark", "System"],
|
||||||
command=self.change_appearance_mode)
|
command=self.change_appearance_mode)
|
||||||
self.appearance_mode_optionemenu.grid(row=6, column=0, padx=20, pady=(10, 10))
|
self.appearance_mode_optionemenu.grid(row=6, column=0, padx=20, pady=(10, 10))
|
||||||
self.scaling_label = customtkinter.CTkLabel(self.sidebar_frame, text="Widget Scaling:", anchor="w")
|
self.scaling_label = customtkinter.CTkLabel(self.sidebar_frame, text="UI Scaling:", anchor="w")
|
||||||
self.scaling_label.grid(row=7, column=0, padx=20, pady=(10, 0))
|
self.scaling_label.grid(row=7, column=0, padx=20, pady=(10, 0))
|
||||||
self.scaling_optionemenu = customtkinter.CTkOptionMenu(self.sidebar_frame, values=["80%", "90%", "100%", "110%", "120%"],
|
self.scaling_optionemenu = customtkinter.CTkOptionMenu(self.sidebar_frame, values=["80%", "90%", "100%", "110%", "120%"],
|
||||||
command=self.change_scaling)
|
command=self.change_scaling)
|
||||||
|
Loading…
Reference in New Issue
Block a user