Advertisement
lalalalalalalaalalla

Untitled

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