Advertisement
lalalalalalalaalalla

Untitled

Sep 10th, 2019
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.00 KB | None | 0 0
  1. f = '1.0/sin(2.0 * x)'
  2. # f = input()
  3.  
  4. root = Tk()
  5.  
  6. canv = Canvas(root, width = 1000, height = 1000, bg = "white")
  7. canv.create_line(500,1000,500,0,width=2,arrow=LAST)
  8. canv.create_line(0,500,1000,500,width=2,arrow=LAST)
  9.  
  10. First_x = -500
  11.  
  12. for i in range(16000):
  13.     if (i % 800 == 0):
  14.         k = First_x + (1 / 16) * i
  15.         canv.create_line(k + 500, -3 + 500, k + 500, 3 + 500, width = 0.5, fill = 'black')
  16.         canv.create_text(k + 515, -10 + 500, text = str(k), fill="purple", font=("Helvectica", "10"))
  17.         if (k != 0):
  18.             canv.create_line(-3 + 500, k + 500, 3 + 500, k + 500, width = 0.5, fill = 'black')
  19.             canv.create_text(20 + 500, k + 500, text = str(k), fill="purple", font=("Helvectica", "10"))
  20.     try:
  21.         x = First_x + (1 / 16) * i
  22.         new_f = f.replace('x', str(x))
  23.         y = -eval(new_f) + 500
  24.         print(new_f)
  25.         x += 500
  26.         canv.create_oval(x, y, x + 1, y + 1, fill = 'black')
  27.     except:
  28.         pass
  29. canv.pack()
  30. root.mainl
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement