Home arrow Python arrow Page 3 - Mobile Programming using PyS60: Advanced UI Controls

PyS60 in Real World - Python

In an earlier article I wrote, the topic of discussion covered the basic UI controls that PyS60 provides. These controls are useful when the solution to be developed is simple in terms of interaction. However, if a scenario presents itself where interaction becomes complex, then the basic controls would not suffice. Keep reading to learn about the advanced controls you'll need to deal with these kinds of issues.

TABLE OF CONTENTS:
  1. Mobile Programming using PyS60: Advanced UI Controls
  2. Text
  3. PyS60 in Real World
  4. Reprocessing the Result
By: A.P.Rajshekhar
Rating: starstarstarstarstar / 3
December 29, 2008

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

In the last discussion, a guessing game was developed. The code was as follows


from appuifw import *


continue_guess=true


while continue_guess:

guess_no=random()

user_guess=query(u”Enter your guess”, ‘number’)

if user_guess is Null:

note(u”You have opted out”)

continue_guess=false

elif user_guess<guess_no:

note(u”Your guess is lesser than the goal”)

elif user_guess>guess_no:

note(u”Your guess is higher than the goal”)

else:

note(u”Congrats for excellent guess”)


user_choice=query(u”Enter Y to continue or N to quit”)

 

if user_choice is Null or user_choice==’N’:

continue_guess=false

else:

continue_guess=true


Now, let us change the display part for displaying the choices. Instead of taking user’s input using a query dialog, let us show a selection list from which the user can select a value. The following code


user_guess=query(u”Enter your guess”, ‘number’)


needs to be changed to


list = [guess-100, guess, guess*200, u”Quit”]

user_guess = selection_list(list)


First, a list is created using the guess number and its combination. Then the list is given as an argument to the selection_list() method. The returned index, which is the value selected by the user, is then stored in the user_guess variable.



 
 
>>> More Python Articles          >>> More By A.P.Rajshekhar
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PYTHON ARTICLES

- Python Big Data Company Gets DARPA Funding
- Python 32 Now Available
- Final Alpha for Python 3.2 is Released
- Python 3.1: String Formatting
- Python 3.1: Strings and Quotes
- Python 3.1: Programming Basics and Strings
- Tuples and Other Python Object Types
- The Dictionary Python Object Type
- String and List Python Object Types
- Introducing Python Object Types
- Mobile Programming using PyS60: Advanced UI ...
- Nested Functions in Python
- Python Parameters, Functions and Arguments
- Python Statements and Functions
- Statements and Iterators in Python

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: