Categories: Python | Code Examples | S60 | UI
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:
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:
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:
| 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 |
