adjust node text and edge text to scale not as fast as other components
This commit is contained in:
parent
b0a3c85f0e
commit
933f409498
2 changed files with 8 additions and 6 deletions
|
@ -1,3 +1,4 @@
|
|||
import math
|
||||
import tkinter as tk
|
||||
from tkinter import font, ttk
|
||||
|
||||
|
@ -47,11 +48,10 @@ class Application(tk.Frame):
|
|||
|
||||
def setup_scaling(self):
|
||||
self.fonts_size = {name: font.nametofont(name)["size"] for name in font.names()}
|
||||
text_scale = self.app_scale if self.app_scale < 1 else math.sqrt(self.app_scale)
|
||||
themes.scale_fonts(self.fonts_size, self.app_scale)
|
||||
self.icon_text_font = font.Font(
|
||||
family="TkIconFont", size=int(12 * self.app_scale)
|
||||
)
|
||||
self.edge_font = font.Font(family="TkDefaultFont", size=int(8 * self.app_scale))
|
||||
self.icon_text_font = font.Font(family="TkIconFont", size=int(12 * text_scale))
|
||||
self.edge_font = font.Font(family="TkDefaultFont", size=int(8 * text_scale))
|
||||
|
||||
def setup_theme(self):
|
||||
themes.load(self.style)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import logging
|
||||
import math
|
||||
import tkinter as tk
|
||||
from tkinter import ttk
|
||||
from typing import TYPE_CHECKING
|
||||
|
@ -127,8 +128,9 @@ class PreferencesDialog(Dialog):
|
|||
|
||||
# scale fonts
|
||||
scale_fonts(self.app.fonts_size, app_scale)
|
||||
self.app.icon_text_font.config(size=int(12 * app_scale))
|
||||
self.app.edge_font.config(size=int(8 * app_scale))
|
||||
text_scale = app_scale if app_scale < 1 else math.sqrt(app_scale)
|
||||
self.app.icon_text_font.config(size=int(12 * text_scale))
|
||||
self.app.edge_font.config(size=int(8 * text_scale))
|
||||
|
||||
# scale application window
|
||||
self.app.center()
|
||||
|
|
Loading…
Reference in a new issue