Home arrow Python arrow Page 4 - Mobile Programming in Python using PyS60: Getting Started

PyS60 Programming in the Real World - Python

Smart phones are becoming a common sight nowadays. Above all, the "smartness" of smart phones come from the fact that they can be programmed. In other words, one can develop custom applications for these mobile devices and use them in the devices. This article covers the basics of developing these kinds of applications in a variant of Python.

TABLE OF CONTENTS:
  1. Mobile Programming in Python using PyS60: Getting Started
  2. Dynamically loadable libraries or extensions
  3. Accessing Services, Step By Step
  4. PyS60 Programming in the Real World
By: A.P.Rajshekhar
Rating: starstarstarstarstar / 16
October 17, 2007

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

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
 

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: