Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #By Staggen
- #coding: iso-8859-1
- from Tkinter import*
- from math import*
- from cmath import*
- root=Tk()
- class Main_Window(Frame):
- def __init__(self, parent = None):
- Frame.__init__(self,parent)
- self.parent=parent
- root.title("Matematikhjälpen")
- def equationsWindow(self):
- eqWin=Toplevel(self)
- eqWin.title("Ekvationslösare")
- etiquette1=Label(eqWin,text="Jag löser ekvationer av första och andra graden.")
- etiquette1.pack(padx=10,pady=5,expand=True,fill=BOTH)
- eqGroup=LabelFrame(eqWin,text="Inmatning",padx=5,pady=5)
- eqGroup.pack(padx=100,pady=5,fill=BOTH)
- etiquette2=Label(eqGroup,text="ax^2 + bx + c")
- etiquette2.pack(padx=10,pady=10,expand=True,fill=BOTH)
- etiquette3=Label(eqGroup,text="Ange värde på a")
- etiquette3.pack(padx=10,pady=10,expand=True,fill=BOTH)
- input1=Entry(eqGroup,width=10)
- input1.pack()
- etiquette4=Label(eqGroup,text="Ange värde på b")
- etiquette4.pack(padx=10,pady=10,expand=True,fill=BOTH)
- input2=Entry(eqGroup,width=10)
- input2.pack()
- etiquette5=Label(eqGroup,text="Ange värde på c")
- etiquette5.pack(padx=10,pady=10,expand=True,fill=BOTH)
- input3=Entry(eqGroup,width=10)
- input3.pack()
- a=input1.get()
- b=input2.get()
- c=input3.get()
- a=DoubleVar()
- b=DoubleVar()
- c=DoubleVar()
- temp1=pow(b/2,2)
- temp1=DoubleVar()
- temp2=sqrt(temp1-c)
- temp2=DoubleVar()
- X1=(-b/2)+temp1 #I tried to convert
- X2=(-b/2)-(sqrt(pow(b/2,2)-c))
- #button1=Button(eqGroup,text="Beräkna",command=equationSolver)
- eqGroup2=LabelFrame(eqWin,text="Utskrift",padx=5,pady=5)
- eqGroup2.pack(padx=100,pady=5,fill=BOTH)
- etiquette6=Label(eqGroup2,text="Svar X1 och X2 är:")
- etiquette6.pack(padx=10,pady=10,expand=True,fill=BOTH)
- etiquette7=Label(eqGroup2,text=X1)
- etiquette7.pack(padx=10,pady=10,expand=True,fill=BOTH)
- etiquette8=Label(eqGroup2,text=X2)
- etiquette8.pack(padx=10,pady=10,expand=True,fill=BOTH)
- def trianglesWindow(self):
- trWin=Toplevel(self)
- trWin.title("Geometri: Trianglar")
- etiquette2=Label(trWin,text="It works!")#Placeholder
- etiquette2.pack(padx=100,pady=100,expand=True,fill=BOTH)
- #Insert functional code here.
- def squaresWindow(self):
- sqWin=Toplevel(self)
- sqWin.title("Geometri: Fyrhörningar")
- etiquette3=Label(sqWin,text="It works!")#Placeholder
- etiquette3.pack(padx=100,pady=100,expand=True,fill=BOTH)
- #Insert functional code here.
- class Main_Class(Main_Window):
- if __name__ == "__main__":
- main=Main_Window(root)
- topMenu=Menu(root)
- equations=Menu(topMenu)
- geometry=Menu(topMenu)
- root.config(menu=topMenu)
- topMenu.add_cascade(label="Ekvationer",menu=equations)
- topMenu.add_cascade(label="Geometri",menu=geometry)
- equations.add_radiobutton(label="Första- och Andragradsekvationer",command=main.equationsWindow)
- geometry.add_radiobutton(label="Trianglar",command=main.trianglesWindow)
- geometry.add_radiobutton(label="Fyrhörningar",command=main.squaresWindow)
- main.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement