Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # s60_360dict.py
- import e32,audio,appuifw,os,sys,key_codes,time,math,random,graphics,copy,sysinfo
- from appuifw import *
- Deg = {'-----' : '-----'#
- def draw(rect): # >>> draw(())
- if img:
- canvas.blit(img)
- #
- def fr_sp(z=0.05):
- if time.time() > cv.wait:
- cv.wait=time.time()+z
- return True
- #
- class cv():
- go=1
- wait=0
- cv=cv()
- app.screen = 'large'
- app.directional_pad = False
- app.orientation='portrait'
- img=None
- app.body = canvas = Canvas(redraw_callback=draw) #
- X,Y=canvas.size
- img=graphics.Image.new((X,Y))
- def oExit(): cv.go=False
- def exit_btn(): app.exit_key_handler=oExit
- import sensor
- def xyzsens():
- try:
- cv.xyz=(sens.x,sens.y,sens.z)
- except: pass
- sens=sensor.AccelerometerXYZAxisData(data_filter=sensor.LowPassFilter())
- sens.set_callback(data_callback=xyzsens)
- sens.start_listening()
- def up_event(event):
- cv.x,cv.y=0,0
- def dn_event(event):
- cv.x,cv.y=event
- def mv_event(event):
- cv.x,cv.y=event
- #
- canvas.bind(key_codes.EButton1Up, up_event, ((0,0), (X,Y)))
- canvas.bind(key_codes.EButton1Down, dn_event, ((0,0), (X,Y)))
- canvas.bind(key_codes.EDrag, mv_event, ((0,0), (X,Y)))
- exit_btn()
- c=100
- cv.go = 1
- while cv.go:
- if fr_sp(0.03):
- img.clear(0)
- x,y = degrad(c*5,c**2/5000)
- sz=c**2/6000
- img.point((int(X/2+x),int(Y/2+y)),0x00ffff,width=sz)
- if x-sz/2 > X/2:
- c=100
- c+=1
- draw(())
- e32.ao_yield()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement