Advertisement
lalalalalalalaalalla

Untitled

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