Advertisement
here2share

# Tk_spiralpowered.py

Nov 14th, 2020
1,870
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. # Tk_spiralpowered.py
  2.  
  3. from Tkinter import *
  4. from PIL import Image, ImageTk
  5. import random
  6. import math
  7. import time
  8. ww = 500
  9. hh = 500
  10.  
  11. root = Tk()
  12. root.title("Tk Spiral")
  13. root.geometry("%dx%d+-10+0"%(ww,hh))
  14. canvas = Canvas(root, width=ww, height=hh)
  15. canvas.pack()
  16.  
  17. xy = []
  18. PI = math.pi
  19. ww0 = ww/2
  20. hh0 = hh/2
  21. for i in range(500):
  22.     t = i / 20.0 * PI
  23.     d = i*0.1+i**(0.002*i)
  24.     x = ww0 + d * math.cos(i/5.0)
  25.     y = hh0 + d * math.sin(i/5.0)
  26.     xy.append((x,y))
  27.  
  28. canvas.create_line(xy, fill="purple", width=3)
  29. canvas.update()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement