add a scrollbar next to scale entry to allow scale adjustment in increments of a specific value (since the Scale Slider widget does not support this)
This commit is contained in:
parent
933f409498
commit
58cb5a1a1d
1 changed files with 18 additions and 0 deletions
|
@ -11,6 +11,8 @@ from core.gui.themes import FRAME_PAD, PADX, PADY, scale_fonts
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from core.gui.app import Application
|
from core.gui.app import Application
|
||||||
|
|
||||||
|
SCALE_INTERVAL = 0.01
|
||||||
|
|
||||||
|
|
||||||
class PreferencesDialog(Dialog):
|
class PreferencesDialog(Dialog):
|
||||||
def __init__(self, master: "Application", app: "Application"):
|
def __init__(self, master: "Application", app: "Application"):
|
||||||
|
@ -90,6 +92,9 @@ class PreferencesDialog(Dialog):
|
||||||
)
|
)
|
||||||
entry.grid(row=0, column=1)
|
entry.grid(row=0, column=1)
|
||||||
|
|
||||||
|
scrollbar = ttk.Scrollbar(scale_frame, command=self.adjust_scale)
|
||||||
|
scrollbar.grid(row=0, column=2)
|
||||||
|
|
||||||
def draw_buttons(self):
|
def draw_buttons(self):
|
||||||
frame = ttk.Frame(self.top)
|
frame = ttk.Frame(self.top)
|
||||||
frame.grid(sticky="ew")
|
frame.grid(sticky="ew")
|
||||||
|
@ -138,3 +143,16 @@ class PreferencesDialog(Dialog):
|
||||||
# scale toolbar and canvas items
|
# scale toolbar and canvas items
|
||||||
self.app.toolbar.scale()
|
self.app.toolbar.scale()
|
||||||
self.app.canvas.scale_graph()
|
self.app.canvas.scale_graph()
|
||||||
|
|
||||||
|
def adjust_scale(self, arg1: str, arg2: str, arg3: str):
|
||||||
|
scale_value = self.gui_scale.get()
|
||||||
|
if arg2 == "-1":
|
||||||
|
if scale_value <= 4.9:
|
||||||
|
self.gui_scale.set(scale_value + SCALE_INTERVAL)
|
||||||
|
else:
|
||||||
|
self.gui_scale.set(5.0)
|
||||||
|
elif arg2 == "1":
|
||||||
|
if scale_value >= 0.6:
|
||||||
|
self.gui_scale.set(scale_value - SCALE_INTERVAL)
|
||||||
|
else:
|
||||||
|
self.gui_scale.set(0.5)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue