-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
30 lines (28 loc) · 1.13 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import tkinter as tki
from diagram import *
from files import *
from GUI import *
if __name__ == "__main__":
window = Window()
window.draw()
window.tk.bind("<Button-1>", window.left_click)
window.tk.bind("<Button-3>", window.right_click)
window.tk.bind("<Escape>", window.right_click)
# General keyboard controls: Select all, Copy/Paste, Undo
window.tk.bind("<Control -s>", window.save)
window.tk.bind("<Control -a>", window.group_all)
window.tk.bind("<Control -c>", window.copy)
window.tk.bind("<Control -z>", window.undo)
window.tk.bind("<Control -y>", window.redo)
# Detect mouse wheel with Windows
window.tk.bind("<MouseWheel>", window.zoom_wheel)
# Detect mouse wheel with Linux
window.tk.bind("<Button-4>", window.zoom_wheel)
window.tk.bind("<Button-5>", window.zoom_wheel)
# Keyboard zoom control
window.tk.bind("<Control -o>", window.reset_origin)
window.tk.bind("<Control -q>", window.zoom_more)
window.tk.bind("<Control -w>", window.zoom_less)
# Dectecting dragging: Move the reference
window.tk.bind("<B1-Motion>", window.drag_origin)
window.tk.mainloop()