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:
@@ -2,9 +2,9 @@ import tkinter
|
||||
import sys
|
||||
|
||||
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
|
||||
|
||||
|
||||
@@ -65,13 +65,13 @@ class CTkRadioButton(CTkBaseClass):
|
||||
|
||||
# configure grid system (3x1)
|
||||
self.grid_columnconfigure(0, weight=0)
|
||||
self.grid_columnconfigure(1, weight=0, minsize=6)
|
||||
self.grid_columnconfigure(1, weight=0, minsize=6 * self.scaling)
|
||||
self.grid_columnconfigure(2, weight=1)
|
||||
|
||||
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, padx=0, pady=0, columnspan=1)
|
||||
self.draw_engine = CTkDrawEngine(self.canvas, CTkSettings.preferred_drawing_method)
|
||||
|
||||
@@ -97,7 +97,10 @@ class CTkRadioButton(CTkBaseClass):
|
||||
super().destroy()
|
||||
|
||||
def draw(self, no_color_updates=False):
|
||||
requires_recoloring = self.draw_engine.draw_rounded_rect_with_border(self.width, self.height, self.corner_radius, self.border_width)
|
||||
requires_recoloring = self.draw_engine.draw_rounded_rect_with_border(self.width * self.scaling,
|
||||
self.height * self.scaling,
|
||||
self.corner_radius * self.scaling,
|
||||
self.border_width * self.scaling)
|
||||
|
||||
self.canvas.configure(bg=CTkThemeManager.single_color(self.bg_color, self.appearance_mode))
|
||||
self.configure(bg=CTkThemeManager.single_color(self.bg_color, self.appearance_mode))
|
||||
@@ -120,7 +123,7 @@ class CTkRadioButton(CTkBaseClass):
|
||||
bd=0,
|
||||
text=self.text,
|
||||
justify=tkinter.LEFT,
|
||||
font=self.text_font)
|
||||
font=self.apply_font_scaling(self.text_font))
|
||||
self.text_label.grid(row=0, column=2, padx=0, pady=0, sticky="w")
|
||||
self.text_label["anchor"] = "w"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user