Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 22:18, 7 July 2008.

Python Input and Output

From Forum Nokia Wiki

This article describes the various ways of displaying and getting information in PyS60 using the appuifw module.

Input

Queries:

import appuifw
 
appuifw.query(u"Enter a word", "text") 
#prompts for a string  
  
appuifw.query(u"Enter a number", "number")  
#prompts for an integer 
  
appuifw.query(u"Enter a password", "code")  
#prompts for a combination of numbers and letters, and shows them as "*" for protection 
 
appuifw.query(u"Enter a time", "time")   
#prompts for a time in hh:mm format
  
appuifw.query(u"Do you play golf?", "query")
#displays a question
 
appuifw.multi_query(u"Object1", u"Object2")
#prompts for two fields of information


Screenshots of the above items, in order:

Image:Query1.JPG   Image:Query2.JPG   Image:Query3.JPG

Image:Query4.JPG   Image:Query5.JPG   Image:Query6.JPG

Output

Notes:

import appuifw
 
appuifw.note(u"Good to have you back")
#displays a simple message
 
appuifw.note(u"File not found", "error")
#displays the message as a warning with appropriate sound
 
appuifw.note(u"Installation complete", "conf")
#displays the message as a confirmation with appropriate sound

Popup:

import appuifw
 
p=appuifw.InfoPopup()
 
p.show(u"Text goes here", (x, y), 5000, 0)
#Shows the popup containing the text at the coordinates x and y
#for 5000 milliseconds and with 0 milliseconds waited before it is displayed
 
p.hide()  #Hides the popup immediately


Screenshots of the above items, in order:

Image:Note1.JPG   Image:Note2.JPG

Image:Note3.JPG   Image:Popup.JPG

Both

Popup menu:

import appuifw
 
appuifw.popup_menu([u"Option1", u"Option2"])
#displays a list of options in the shape of a menu

Selection list and multi selection list:

import appuifw
 
appuifw.selection_list([u"Option1", u"Option2"])
#displays a list of options
 
appuifw.multi_selection_list([u"Option1", u"Option2"], style='checkbox', search_field=1)
#displays a sort of checkbox list of options, with the index of the selected options returned as a tuple
#style can be 'checkmark' for the options to be ticked when selected; if search_field is 1, a search field is available


Screenshots for the above items, in order:

Image:Popup_menu.JPG   Image:Selection_list.JPG   Image:Multi_selection_list.JPG

Related Discussions
Thread Thread Starter Forum Replies Last Post
Could I add a new input mode into the phone? zhouhuayu Mobile Java General 9 2006-05-11 18:20
need help with python mizi_joe Python 1 2006-06-26 17:08
Text Box Length rishabhgupta Python 5 2008-05-27 18:12
Letter by letter analysis richie.rich Python 2 2007-11-24 15:47
writing first Python program lrp18th Python 1 2007-11-26 04:43
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtopicQUqfnTopicZpythonQ
     qfnZtopicQUqfnTopicZseriesE5f60Q
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX