Advertisement
here2share

# Tk_star_polygon_demo2_rounded_thinner.py

Aug 5th, 2015
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.81 KB | None | 0 0
  1. # Tk_star_polygon_demo2_rounded_thinner.py
  2.  
  3. from Tkinter import Tk, Canvas, BOTH
  4.  
  5. root = Tk()
  6. root.geometry("400x400+30+30",)
  7.  
  8. root.title("Star Polygon")
  9. canvas = Canvas()
  10.  
  11. def star_5pt(x,y,s):
  12.     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
  13.     #                           a     b     c     d     e     f     g     h     j     k     m     n     p
  14.     plot_xy = [(a, d), (e, d), (f, a), (h, d), (p, d), (j, g), (m, n), (f, k), (b, n), (c, g)]
  15.     nova=[]
  16.     for xy in plot_xy:
  17.             xy = (xy[0]*0.002)*s+x,(xy[1]*0.002)*s+y
  18.             nova.append(xy)
  19.     return nova
  20. #
  21. star = star_5pt(50,50,300)
  22. canvas.create_polygon(star,outline='purple',width=50)
  23. canvas.create_polygon(star,outline=root['bg'],fill=root['bg'],width=40)
  24. canvas.pack(fill=BOTH,expand=1)
  25.  
  26. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement