×
Namespaces

Variants
Actions
Revision as of 22:58, 5 December 2008 by bogdan.galiceanu (Talk | contribs)

Archived:How to use the camera viewfinder in PySymbian

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): Nokia N95, Nokia E90
Compatibility
Platform(s): S60 2nd Edition, S60 3rd Edition
Article
Keywords: camera
Created: (15 May 2007)
Last edited: bogdan.galiceanu (05 Dec 2008)

Contents

Overview

This snippet shows how to use the camera viewfinder in Python.

Preconditions

Note: The camera module is not available for S60 1st Edition.

Source code

import appuifw, e32, camera
 
 
app_lock = e32.Ao_lock()
#Define the exit function
def quit():
#Close the viewfinder
camera.stop_finder()
#Release the camera so that other programs can use it
camera.release()
app_lock.signal()
appuifw.app.exit_key_handler = quit
 
#Function for displaying the viewfinder
def vf(im):
appuifw.app.body.blit(im)
 
#Set the application's body to Canvas
appuifw.app.body = appuifw.Canvas()
 
#Start the viewfinder and keep the backlight on
camera.start_finder(vf, backlight_on = 1)
 
#Wait for the user to request the exit
app_lock.wait()

Postconditions

The viewfinder is shown on the device's screen and the backlight is kept on.

80 page views in the last 30 days.
×