Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_star_polygon_demo2_rounded_thinner.py
- from Tkinter import Tk, Canvas, BOTH
- root = Tk()
- root.geometry("400x400+30+30",)
- root.title("Star Polygon")
- canvas = Canvas()
- def star_5pt(x,y,s):
- a,b,c,d,e,f,g,h,j,k,m,n,p = 0, 96, 157, 180, 192, 250, 294, 308, 340, 357, 402, 476, 500
- # a b c d e f g h j k m n p
- plot_xy = [(a, d), (e, d), (f, a), (h, d), (p, d), (j, g), (m, n), (f, k), (b, n), (c, g)]
- nova=[]
- for xy in plot_xy:
- xy = (xy[0]*0.002)*s+x,(xy[1]*0.002)*s+y
- nova.append(xy)
- return nova
- #
- star = star_5pt(50,50,300)
- canvas.create_polygon(star,outline='purple',width=50)
- canvas.create_polygon(star,outline=root['bg'],fill=root['bg'],width=40)
- canvas.pack(fill=BOTH,expand=1)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement