diff --git a/Hyperbola_control.py b/Hyperbola_control.py new file mode 100644 index 0000000000000000000000000000000000000000..cf404042de96cd06e42b6a7e10ee986ced7f07d0 --- /dev/null +++ b/Hyperbola_control.py @@ -0,0 +1,99 @@ +from Hyperbola_draw import hyperbola + +import tkinter as tk + +from tkinter import * + + +def function(): + + # print(e1.get(),e2.get()) + # h = hyperbola() + a = eval(e1.get()) + b = eval(e2.get()) + ax_range = eval(e4.get()) + # line_range = eval(e5.get()) + focus_ax = e3.get() + h = hyperbola(ax_range,ax_range*7) + h.hb_data(a,b,focus=focus_ax) + h.hb_draw() + h.asymptote() + + h.display() +# def e1press1(self): +# e1.config(bg='skyblue') +# def e1press2(self): +# e1.config(bg='white') +# def e2press1(self): +# e2.config(bg='skyblue') +# def e2press2(self): +# e2.config(bg='white') +# def e3press1(self): +# e3.config(bg='skyblue') +# def e3press2(self): +# e3.config(bg='white') + +root=Tk() +root.geometry('500x350') +root.geometry('+400+300') +root.title('双曲线') +root.resizable(False, False) + + +l1 = tk.Label(root, text='a:', + font=('Arial Black',12), + width=3, height=1) +l1.place(relx=0.25, rely=0.03) + +l2 = tk.Label(root, text='b:', + font=('Arial Black',12), + width=3, height=1) +l2.place(relx=0.25, rely=0.13) + +l3 = tk.Label(root, text='焦点:', + font=('楷体',13), + width=5, height=1) +l3.place(relx=0.215, rely=0.23) + +l3_ = tk.Label(root, text='x or y', + font=('Arial',10), + width=5, height=1) +l3_.place(relx=0.65, rely=0.23) + +l4 = tk.Label(root, text='坐标轴长度:', + font=('楷体',13), + width=13, height=1) +l4.place(relx=0.15, rely=0.33) + + +e1 = tk.Entry(root, show = None, bg='white',font=('Arial',10))#显示成明文形式 +e1.place(relx=0.35,rely=0.05) +# e1.bind('',e1press1) +# e1.bind('',e1press2) + + +e2 = tk.Entry(root, show = None, bg='white', font=('Arial',10))#显示成明文形式 +e2.place(relx=0.35, rely=0.15) +# e2.bind('',e2press1) +# e2.bind('',e2press2) + +e3 = tk.Entry(root, show = None, bg='white', font=('Arial',10))#显示成明文形式 +e3.place(relx=0.35, rely=0.25) +# e3.bind('',e3press1) +# e3.bind('',e3press2) +e4 = tk.Entry(root, show = None, bg='white', font=('Arial',10))#显示成明文形式 +e4.place(relx=0.35, rely=0.35) + +# e5 = tk.Entry(root, show = None, bg='white', font=('Arial',10))#显示成明文形式 +# e5.place(relx=0.35, rely=0.45) +# # 第5步,在窗口界面设置放置Button按键hyperbola.Kp +b = tk.Button(root, + text='Show Hyperbola', + font=('Arial', 12), + width=15, height=1, + bg='lightcoral', + command=function) +b.place(relx=0.38, rely=0.75) + +root.mainloop() +