Custom Search

Sunday, January 3, 2010

PyS60 Tutorial - Content Queries

PyS60 Tutorial - Content Queries

------------------------------------

# using this you can store the information entered by the user in a variable.


/*********** Description Start *************/


import appuifw


#asks for a number, in this case integer; for a fractional number use "float"
inf=appuifw.query(u"Enter a number", "number")

#asks for a text
inf=appuifw.query(u"Enter a word", "text")

#asks for a password, and shows the characters as "*" for protection
inf=appuifw.query(u"Enter a password", "code")

#asks for a time in hh:mm format
inf=appuifw.query(u"Enter a time", "time")

#displays a question, the returned values being 1 if the user has selected "Yes" and 0 if the user has selected "No"
inf=appuifw.query(u"Would you like to play again?", "query")

#asks for two fields of information
inf=appuifw.multi_query(u"Part1", u"Part2")

/*********** Description End *************/

/*********** Example 1 Start *************/

import appuifw,e32

def quit():

app_lock.signal()

appuifw.app.exit_key_handler=quit

# Declaring an empty tuple ‘data’

data={}

data['name'] = appuifw.query(u"Enter Name", "text")
data['age'] = appuifw.query(u"Enter age", "number")

data['username'] = appuifw.query(u"Enter UserName", "text")

data['password'] = appuifw.query(u"Enter password", "code")

data['time'] = appuifw.query(u"Enter time", "time")

data['agree'] = appuifw.query(u"Are you agree our terms and conditions?", "query")

if(data['agree']==1):

for key in data:

print key + " : " , data[key]

print "Registration Success"

else:

print "Registration failed"

print "Please agree to continue"

app_lock=e32.Ao_lock()

app_lock.wait()

OUTPUT

----------

name : sanju

age : 22

username : sanju123

password : 123456

time : 12:30

agree : 1

Registration Success

/*********** Example 1 End *************/

No comments:

Post a Comment