Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # star_polygon_demo.py -- Note: the points are rounded
- import appuifw, e32, graphics
- def draw(rect):
- try: canvas.blit(img)
- except: pass
- canvas = appuifw.Canvas(redraw_callback=draw)
- appuifw.app.directional_pad=False
- appuifw.app.orientation='portrait'
- appuifw.app.screen='large'
- appuifw.app.body=canvas
- w,h = canvas.size
- img=graphics.Image.new((w,h))
- def star_5pt(x,y,s):
- a,b,c,d,e,f,g,h,j,k,m,n,p = 0,180,294,476,250,192,308,500,340,402,357,96,157
- plot_xy = [(a,b),(f,b),(e,a),(g,b),(h,b),(j,c),(k,d),(e,m),(n,d),(p,c)]
- 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(30,60,300)
- img.clear((0,0,0))
- img.polygon((star), outline=(0,255,0), width=10, fill=(255,255,0))
- draw(())
- lock = e32.Ao_lock()
- appuifw.app.exit_key_handler = lambda:lock.signal()
- lock.wait()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement