Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # progress_bar_by_gradient.py
- import appuifw,e32,time
- def empty(rect):
- pass
- def draw(rect):
- if not c:
- canvas.clear(0x000000)
- return
- canvas.line((i,barWidthA,i,barWidthB),color,width=2)
- # frame
- canvas.rectangle((0,barWidthA,X,barWidthB+2),0xffffff)
- time.sleep(0.009) ### Otherwise Too Fast ???
- ### >>> Additional Python Code <<<
- def forLight():
- appuifw.e32.reset_inactivity()
- timer.after(10,forLight)
- def exit(): global run; run=0
- appuifw.app.exit_key_handler=exit
- timer=appuifw.e32.Ao_timer()
- forLight()
- appuifw.app.orientation='portrait'
- appuifw.app.directional_pad=False
- canvas=appuifw.Canvas(redraw_callback=empty)
- appuifw.app.body=canvas
- X,Y=canvas.size
- barWidthA=140
- barWidthB=barWidthA+19
- run=1
- c=None
- color=0x000000
- canvas=appuifw.Canvas(redraw_callback=draw)
- appuifw.app.body=canvas
- while run:
- draw(())
- for i in range(X):
- if not run: break
- c=int(((255.0*2)/X)*i)
- if not c > 255:
- # red marker
- color=(255,c,0)
- else:
- # green marker
- c -= 255
- color=(255-c,255,0)
- draw(())
- e32.ao_yield()
- c=None
- timer.cancel()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement