Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_radial_sparse.py
- import math
- from tkinter import *
- ww = 600
- hh = 600
- root = Tk()
- root.title("Tk_radial_sparse")
- root.geometry("%dx%d+-10+0"%(ww,hh))
- canvas = Canvas(root, width=ww, height=hh)
- canvas.pack()
- xy = []
- PI = math.pi
- ww0 = ww/2
- hh0 = hh/2
- for r in range(1,500,5):
- circumference = (r * 2 * PI) / ((r + 200.0) / 50)
- if not circumference:
- circumference = 1
- for degrees in range(0,360,int(360.0/circumference)):
- angle = math.radians(degrees)
- x = int(r * math.cos(angle))+ww0
- y = int(r * math.sin(angle))+hh0
- if 0 < x < ww-3 and 0 < y < hh-3:
- xy.append((x,y))
- canvas.create_oval(x,y,x+3,y+3, fill="purple", outline="")
- canvas.update()
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement