Python
  Home arrow Python arrow Page 4 - Mobile Programming in Python using PyS60: Getting Started
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 in Python using PyS60: Getting Started
By: A.P.Rajshekhar
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 11
    2007-10-17


    Table of Contents:
  • Mobile Programming in Python using PyS60: Getting Started
  • Dynamically loadable libraries or extensions
  • Accessing Services, Step By Step
  • PyS60 Programming in the Real World

  • 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 in Python using PyS60: Getting Started - PyS60 Programming in the Real World
    ( Page 4 of 4 )

    The application to be developed will have the following functionalities:

      1. An Input box to accept the path for the file to be played.

      2. The ability to play a selected file when entered by the user.

    Here we go. First comes the imports. Since both UI and Sound are required, the appuifw and audio modules need to be imported.

    from appuifw import *

    import audio

    Next we need to show the entry box to the user and get the path entered by him or her. To display the text box, we can use the query component. The first argument is the prompt to be shown and the second argument is the type of query. The type can be ‘text’, ’date’, ’time’, ’float’ etc. Here the type will be text as we need textual data i.e. a string. The value returned by the query component will be stored in a variable named data. 

    from appuifw import *

    import audio

    data=query(u’Enter the path of the file to be played’, ‘text’)

    Now we need to load the file. For that we need to call the load method of sound. As discussed in the previous section every method in the sound module is static. We will also check whether the user clicked cancel. If cancel has been clicked, then data will contain null.

    from appuifw import *

    import audio

    data=query(u’Enter the path of the file to be played’, ‘text’)

    if data is not Null:

    Sound.load(data)

    else:

    note(u’Give the path name’, ‘info’)

    Next let us tell Symbian to play it.

    from appuifw import *

    import audio

    data=query(u’Enter the path of the file to be played’, ‘text’)

    if data is not Null:

    Sound.load(data)

    Sound.play()

    else:

    note(u’Give the path name’, ‘info’)

    That completes our application. Though it is small, it introduces several important concepts of PyS60. In the coming discussions, I will go into more depth on each module. Till then…



     
     
    >>> 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 1 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek