Advertisement
here2share

# screenshot_demo.py

Jan 10th, 2015
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # screenshot_demo.py
  2.  
  3. import e32, time, graphics
  4. from random import randint
  5. from appuifw import *
  6.  
  7. # Define exit function
  8. def quit():
  9.         App_lock.signal()
  10. app.exit_key_handler = quit
  11.  
  12. def draw(rect):
  13.     try: canvas.blit(img)
  14.     except: pass
  15.  
  16. img=None
  17. app.screen='large'
  18. app.orientation='portrait'
  19. app.directional_pad=False
  20. app.body=canvas=Canvas(redraw_callback=draw)
  21. img=graphics.Image.new(canvas.size)
  22. res_x, res_y=canvas.size
  23.  
  24. s=90
  25. for x in range(0,s*4,s):
  26.     for y in range(0,s*7,s):
  27.         img.rectangle((x,y,x+s,y+s),fill=(randint(80,255),randint(80,255),randint(80,255)))
  28. img.text((148,60),unicode(randint(100000,999999)),font=('dense',60))
  29. draw(())
  30. def exit(pos):
  31.     app_lock.signal()
  32.  
  33. App_lock = e32.Ao_lock()
  34. App_lock.wait() # Wait for exit event
  35.  
  36. myImage=graphics.screenshot()
  37. myImage.save(u"E:\\Python\\myImage.png")
  38. note(u'Screenshot Has Been Saved As: myImage.png\n... Hopefully.','conf')
  39.  
  40. App_lock.wait() # Wait for exit event
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement