fixed scaling update of CTkLabel

This commit is contained in:
Tom Schimansky 2022-05-22 19:56:18 +02:00
parent eeeb85ec0d
commit a1cd4abddd
3 changed files with 6 additions and 5 deletions

View File

@ -2,7 +2,6 @@ import tkinter
from .ctk_canvas import CTkCanvas
from ..theme_manager import ThemeManager
from ..settings import Settings
from ..draw_engine import DrawEngine
from .widget_base_class import CTkBaseClass
@ -68,6 +67,8 @@ class CTkLabel(CTkBaseClass):
self.text_label.configure(font=self.apply_font_scaling(self.text_font))
self.text_label.grid(row=0, column=0, padx=self.apply_widget_scaling(self.corner_radius))
self.draw()
def draw(self, no_color_updates=False):
requires_recoloring = self.draw_engine.draw_rounded_rect_with_border(self.apply_widget_scaling(self.current_width),
self.apply_widget_scaling(self.current_height),

View File

@ -40,13 +40,13 @@ class App(customtkinter.CTk):
self.frame.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER)
self.label_1 = customtkinter.CTkLabel(master=self.frame, width=200, height=60,
fg_color=("gray70", "gray35"), text="CustomTkinter\ninterface example")
fg_color=("gray70", "gray25"), text="CustomTkinter\ninterface example")
self.label_1.place(relx=0.5, rely=0.3, anchor=tkinter.CENTER)
self.entry_1 = customtkinter.CTkEntry(master=self.frame, corner_radius=20, width=200, placeholder_text="username")
self.entry_1 = customtkinter.CTkEntry(master=self.frame, corner_radius=6, width=200, placeholder_text="username")
self.entry_1.place(relx=0.5, rely=0.52, anchor=tkinter.CENTER)
self.entry_2 = customtkinter.CTkEntry(master=self.frame, corner_radius=20, width=200, show="*", placeholder_text="password")
self.entry_2 = customtkinter.CTkEntry(master=self.frame, corner_radius=6, width=200, show="*", placeholder_text="password")
self.entry_2.place(relx=0.5, rely=0.6, anchor=tkinter.CENTER)
self.button_2 = customtkinter.CTkButton(master=self.frame, text="Login",

View File

@ -1,7 +1,7 @@
[metadata]
name = customtkinter
version = 4.0.0
description = Create modern looking GUIs with tkinter and Python
description = Create modern looking GUIs with Python
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/TomSchimansky/CustomTkinter