Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # screenshot_demo.py
- import e32, time, graphics
- from random import randint
- from appuifw import *
- # Define exit function
- def quit():
- App_lock.signal()
- app.exit_key_handler = quit
- def draw(rect):
- try: canvas.blit(img)
- except: pass
- img=None
- app.screen='large'
- app.orientation='portrait'
- app.directional_pad=False
- app.body=canvas=Canvas(redraw_callback=draw)
- img=graphics.Image.new(canvas.size)
- res_x, res_y=canvas.size
- s=90
- for x in range(0,s*4,s):
- for y in range(0,s*7,s):
- img.rectangle((x,y,x+s,y+s),fill=(randint(80,255),randint(80,255),randint(80,255)))
- img.text((148,60),unicode(randint(100000,999999)),font=('dense',60))
- draw(())
- def exit(pos):
- app_lock.signal()
- App_lock = e32.Ao_lock()
- App_lock.wait() # Wait for exit event
- myImage=graphics.screenshot()
- myImage.save(u"E:\\Python\\myImage.png")
- note(u'Screenshot Has Been Saved As: myImage.png\n... Hopefully.','conf')
- App_lock.wait() # Wait for exit event
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement