Take and save a picture

Description:

This exaple show how to make a script to take a picture and save  it  on the phone. The modules appuifw, camera, e32 and graphics are used.

###################################################
#Python examples for AAU Mobile Phone Programming #
#(c) Mobile Phone Group #
###################################################

import camera,e32,appuifw
from graphics import *
def main_menu():
appuifw.app.menu = [(u"Take Pic", Take_Pic),(u"Exit",app_exit)]
def Take_Pic():
appuifw.app.body=old_body
image= camera.take_photo()
name = appuifw.query(u'Save as:', "text")
if name=='':
name='untitled'
appuifw.note(u'picture saved', "info")
appuifw.app.body=c=appuifw.Canvas()
c.blit(image,scale=1)
path=(u'c:\\Nokia\\Images\\'+name+u'.jpg')
image.save(path)
def app_exit():
appuifw.app.set_exit()
old_body=appuifw.app.body
lock = e32.Ao_lock()
appuifw.app.title = u"Take Pic"
main_menu()
lock.wait()

Download:

ex4.py

Output:

The following screenshots are the outcome. Just click on the icons to enlarge them for a better view.

Output

Department of Electronic Systems | Aalborg University | Niels Jernes Vej 12 | DK-9220 Aalborg | Denmark
Phone: (+45) 9635 8695 | Fax (+45) 9815 1583 | E-mail ies(at)ies.aau.dk
Copyright © 2006 Department of Electronic Systems

Last update:02-10-2006