Python
  Home arrow Python arrow Page 3 - Mobile Programming using PyS60: Advanced UI Controls
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
PYTHON

Mobile Programming using PyS60: Advanced UI Controls
By: A.P.Rajshekhar
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 1
    2008-12-29


    Table of Contents:
  • Mobile Programming using PyS60: Advanced UI Controls
  • Text
  • PyS60 in Real World
  • Reprocessing the Result

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Mobile Programming using PyS60: Advanced UI Controls - PyS60 in Real World
    ( Page 3 of 4 )

    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
     

       

    PYTHON ARTICLES

    - 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
    - Sequences and Sets in Python
    - Python Expressions and Operators
    - Dictionaries, Variables and Statements in Py...
    - Data Types in Python
    - The Python Language
    - SSH with Twisted





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek