Advertisement
here2share

# Tk_heart.py

Sep 26th, 2018
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. # Tk_heart.py
  2.  
  3. from Tkinter import *
  4. from math import *
  5. import time
  6.  
  7. class Cv(): 0
  8. cv = Cv()
  9.  
  10. root = Tk()
  11. root.title('Got A Love For Programming')
  12.  
  13. canvas = Canvas(root, width=600, height=600, bg='white') # 0,0 is top left corner
  14. canvas.pack(expand=YES, fill=BOTH)
  15.  
  16. x2 = 0
  17. xx,yy = 300,500
  18.  
  19.  
  20. for i in range(63):
  21.     x1 = 0.25 * (-pow(i,2) + 43*i + 1200)*sin((pi*i)/180)
  22.     y1 = -0.25 * (-pow(i,2) + 43*i + 1200)*cos((pi*i)/180) + yy
  23.     if not x2:
  24.         x2 = x1
  25.         y2 = y1
  26.     canvas.create_line(x1+xx-12,y1,x2+xx-12,y2, fill='red', width=5)
  27.     canvas.create_line(-x1+xx,y1,-x2+xx,y2, fill='red', width=5)
  28.     x2 = x1
  29.     y2 = y1
  30. canvas.update()
  31.  
  32. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement