use textvariable in tk.Label

This commit is contained in:
Bruno Cabral 2023-07-19 11:28:49 -07:00 committed by GitHub
parent ed331b1f4f
commit 12d0ff127d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,6 +87,8 @@ class CTkLabel(CTkBaseClass):
self._canvas.grid(row=0, column=0, sticky="nswe") self._canvas.grid(row=0, column=0, sticky="nswe")
self._draw_engine = DrawEngine(self._canvas) self._draw_engine = DrawEngine(self._canvas)
self.textvariable = textvariable
self._label = tkinter.Label(master=self, self._label = tkinter.Label(master=self,
highlightthickness=0, highlightthickness=0,
padx=0, padx=0,
@ -96,7 +98,8 @@ class CTkLabel(CTkBaseClass):
compound=self._compound, compound=self._compound,
wraplength=self._apply_widget_scaling(self._wraplength), wraplength=self._apply_widget_scaling(self._wraplength),
text=self._text, text=self._text,
font=self._apply_font_scaling(self._font)) font=self._apply_font_scaling(self._font),
textvariable=self.textvariable)
self._label.configure(**pop_from_dict_by_set(kwargs, self._valid_tk_label_attributes)) self._label.configure(**pop_from_dict_by_set(kwargs, self._valid_tk_label_attributes))
check_kwargs_empty(kwargs, raise_error=True) check_kwargs_empty(kwargs, raise_error=True)