-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgui.py
More file actions
41 lines (27 loc) · 1.08 KB
/
gui.py
File metadata and controls
41 lines (27 loc) · 1.08 KB
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
import modules as mod
import maths
import validation as valid
import tkinter as tk
answer = ""
window = tk.Tk()
window.title("Linear")
label = tk.Label(text="Enter The Equation")
entry = tk.Entry()
def myclick():
equation = entry.get()
if valid.checknumberafterequal(equation) == False or valid.checkequalsign(equation) == False or valid.checkoperator(equation) == False :
answer = "wrong format"
else :
if mod.findtypeoftequation(equation) == 1 :
answer = maths.calculatetype1(mod.findlastnumber(equation),mod.findnumberbeforex(equation),mod.findnumberafterequal(equation),mod.findoperator(equation))
else :
answer = maths.calculatetype2(mod.findlastnumber(equation),mod.findnumberbeforex(equation),mod.findnumberafterequal(equation),mod.findoperator(equation))
entry.delete(0,len(entry.get()))
entry.insert(0,answer)
button = tk.Button(text="Calculate",command=myclick)
window.geometry("200x100")
window.configure(bg="#58FA82")
label.pack()
entry.pack()
button.pack()
window.mainloop()