Untitled

mail@pastecode.io avatar
unknown
python
a year ago
971 B
3
Indexable
Never
import tkinter as tk


root = tk.Tk()

mycanvas = tk.Canvas(root, width=420, height=335,bg="white")
mycanvas.pack()

for i in range(11):
    mycanvas.create_line(100, 20+i*25, 400, 20+i*25,fill="black")

for i in range(7):
    mycanvas.create_line(100+i*50,20, 100+i*50,270,fill="black")

cnt=0
for i in range(270,19,-50):
    mycanvas.create_text(75, i, text=cnt,fill='black',font=('Arial', 18))   
    cnt+=200
cnt=0
for i in range(100,401,50):
    mycanvas.create_text(i, 290, text=cnt,fill='black',font=('Arial', 18))   
    cnt+=1

mycanvas.create_text(30, 140, text='f(n)',fill='black',font=('Arial', 22))
mycanvas.create_text(230, 320, text='n',fill='black',font=('Arial', 22))

ans=[0]*10
cur=1
for i in range(1,10):
    cur*=i
    ans[i]=ans[i-1]+cur

y=[0]*10
for i in range(7):
    y[i]=270-ans[i]*0.25

x=[0]*10
x[0]=100
for i in range(1,7):
    x[i]=x[i-1]+50

for i in range(6):
    mycanvas.create_line(x[i],y[i],x[i+1],y[i+1],fill="red")

root.mainloop()