-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Main.py
44 lines (35 loc) · 1.07 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from Tkinter import *
from Model import Model
root = Tk()
model = Model()
canvas = Canvas(width=800, height=600, bg='white')
commandLine = Canvas(width=800, height=30, bg='gray')
def drawCanvas(canv, commandLine, model):
canv.delete("all")
commandLine.delete("all")
model.drawElementList(canv)
commandLine.create_text(400, 15, text=model.responseText)
def setPoint(event):
model.setPoint(event.x, event.y)
drawCanvas(canvas, commandLine, model)
def setForce(event):
model.setForce()
drawCanvas(canvas, commandLine, model)
def setFixture(event):
model.setFixture()
drawCanvas(canvas, commandLine, model)
def endPoint(event):
model.endPoint()
drawCanvas(canvas, commandLine, model)
def calculate(event):
endPoint(event)
model.newCalculation()
canvas.bind("<Button-1>", setPoint)
canvas.bind("<Button-2>", calculate)
canvas.bind("<Button-3>", endPoint)
canvas.bind("<Key-b>", setFixture)
canvas.bind("<Key-f>", setForce)
canvas.pack(expand=YES, fill=BOTH)
commandLine.create_text(400, 15, text=model.responseText)
commandLine.pack(expand=YES, fill=BOTH)
root.mainloop()