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.
This commit is contained in:
@@ -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("<Configure>", self.handle_canvas_resize)
|
||||
scrollX['troughcolor'] = scrollY['troughcolor'] = DARK_GRAY
|
||||
scrollX['bg'] = scrollY['bg'] = '#ddf'
|
||||
|
||||
canvas.bind('<Configure>', self.handle_canvas_resize)
|
||||
|
||||
canvas.bind('<Button-1>', lambda event: canvas.scan_mark(event.x, event.y))
|
||||
canvas.bind('<B1-Motion>', lambda event: canvas.scan_dragto(event.x, event.y, gain=7))
|
||||
|
||||
# Star System
|
||||
|
||||
|
||||
Reference in New Issue
Block a user