Let’s draw using tkinter. Hyperbola is my choice!
How to draw a hyperbola?
from tkinter import * root=Tk() c = Canvas(root, width = 650, height = 600, bg = "light grey") c.create_line(300,600,300,0,width=2,arrow=LAST) #axis y c.create_line(0,300,600,300,width=2,arrow=LAST) #axis x c.create_text(312,10,text='300',fill='brown') c.create_text(312,590,text='-300',fill='brown') c.create_text(306,300,text='0',fill='brown') c.create_text(8,290,text='-300',fill='brown') c.create_text(590,290,text='300',fill='brown') label_k=Label(root,text="ratio K=",fg='red') label_k.place(x=0,y=10) entry_k=Entry(root,width=15,bg='white') entry_k.place(x=0,y=35) def gip(k): xy1 = [] xy2 = [] for i in range( 300 ): x = i - 300 y = int( k / x ) xy1.append( 300 - x ) xy1.append( 300 + y ) xy2.append( 300 + x ) xy2.append( 300 - y ) c.create_line( xy1, fill='black' ) c.create_line( xy2, fill='black' ) btn_calc=Button(root,text='Calculate',width=15,fg='green') btn_calc.bind('',lambda event: gip(float(entry_k.get()))) btn_calc.place(x=0,y=60) c.pack() root.mainloop()
You can modyfy the code by easily changing the hyperbola parameters. Also you can change colors 😉