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:
parent
7331580bfd
commit
97178b84a3
8
ui.py
8
ui.py
|
|
@ -69,7 +69,13 @@ class App:
|
||||||
scrollY.grid(row=0, column=1, sticky=N+S)
|
scrollY.grid(row=0, column=1, sticky=N+S)
|
||||||
scrollX.grid(row=1, column=0, sticky=E+W)
|
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
|
# Star System
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue