From 97178b84a3eaf5f8d31a5b20e45e82159dccc84a Mon Sep 17 00:00:00 2001 From: Simon Forman Date: Mon, 15 Apr 2024 21:48:30 -0700 Subject: [PATCH] Bind the mouse to the scan methods. Now you can scroll the star map by "grabbing" the background with the left mouse button and dragging. Super-cool that Tk(inter) makes this so simple. --- ui.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ui.py b/ui.py index 4e2a224..159bf98 100755 --- a/ui.py +++ b/ui.py @@ -69,7 +69,13 @@ class App: scrollY.grid(row=0, column=1, sticky=N+S) scrollX.grid(row=1, column=0, sticky=E+W) - canvas.bind("", self.handle_canvas_resize) + scrollX['troughcolor'] = scrollY['troughcolor'] = DARK_GRAY + scrollX['bg'] = scrollY['bg'] = '#ddf' + + canvas.bind('', self.handle_canvas_resize) + + canvas.bind('', lambda event: canvas.scan_mark(event.x, event.y)) + canvas.bind('', lambda event: canvas.scan_dragto(event.x, event.y, gain=7)) # Star System