mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
added scaling to every widget
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
import tkinter
|
||||
|
||||
from .ctk_canvas import CTkCanvas
|
||||
from ..customtkinter_theme_manager import CTkThemeManager
|
||||
from ..customtkinter_settings import CTkSettings
|
||||
from ..customtkinter_draw_engine import CTkDrawEngine
|
||||
from ..theme_manager import CTkThemeManager
|
||||
from ..ctk_settings import CTkSettings
|
||||
from ..ctk_draw_engine import CTkDrawEngine
|
||||
from .widget_base_class import CTkBaseClass
|
||||
|
||||
|
||||
@ -45,8 +45,8 @@ class CTkLabel(CTkBaseClass):
|
||||
|
||||
self.canvas = CTkCanvas(master=self,
|
||||
highlightthickness=0,
|
||||
width=self.width,
|
||||
height=self.height)
|
||||
width=self.width * self.scaling,
|
||||
height=self.height * self.scaling)
|
||||
self.canvas.grid(row=0, column=0, sticky="nswe")
|
||||
self.draw_engine = CTkDrawEngine(self.canvas, CTkSettings.preferred_drawing_method)
|
||||
|
||||
@ -54,15 +54,18 @@ class CTkLabel(CTkBaseClass):
|
||||
highlightthickness=0,
|
||||
bd=0,
|
||||
text=self.text,
|
||||
font=self.text_font,
|
||||
font=self.apply_font_scaling(self.text_font),
|
||||
**kwargs)
|
||||
self.text_label.grid(row=0, column=0, padx=self.corner_radius)
|
||||
|
||||
self.bind('<Configure>', self.update_dimensions)
|
||||
self.bind('<Configure>', self.update_dimensions_event)
|
||||
self.draw()
|
||||
|
||||
def draw(self, no_color_updates=False):
|
||||
requires_recoloring = self.draw_engine.draw_rounded_rect_with_border(self.width, self.height, self.corner_radius, 0)
|
||||
requires_recoloring = self.draw_engine.draw_rounded_rect_with_border(self.width * self.scaling,
|
||||
self.height * self.scaling,
|
||||
self.corner_radius * self.scaling,
|
||||
0)
|
||||
|
||||
self.canvas.configure(bg=CTkThemeManager.single_color(self.bg_color, self.appearance_mode))
|
||||
|
||||
|
Reference in New Issue
Block a user