×
Namespaces

Variants
Actions
Revision as of 06:03, 30 November 2011 by hamishwillee (Talk | contribs)

Archived:Basic PySymbian application - series1

From Nokia Developer Wiki
Jump to: navigation, search


Contents

Introduction

Mobile applications we know are very interesting and attractive. This article series will help a beginner to develop a good mobile application using the Python for the S60 platform.

The first series will make us understand the structure of an application. A good mobile application developer must have a clear vision about the application structure s/he wants to design.

Application Structure

The figure below tells us about the application structure of a PySymbian application. A good developer at the time of designing a application should always keep this application structure in mind and should try to port his application according to the figure below.

Appli struct.jpg

Explanation

The figure above tells most part of the story, and we will also make lesson out of it.

  • At the top of the figure you can see the application title. That's the portion of our application one should set the title. In PyS60, we can set the title by using.
appuifw.app.title = u"My First App"
  • The navigation tabs are below the title. If you would like to use tabs in your application, look here.

Body

Below navigation tabs comes the body of the application, which is indeed the most important part of the application. In PyS60, basically four kinds of objects can be assigned to the body part:

  • A canvas that handles graphics on screen.
  • A form that is used to built a complex forms that include combination of various fields such as text numbers and lists.
  • A text object that handles a free form text input.
  • A listbox that shows a list of items with

Dialog

Inside the body of the application we can see a dialog window. In a dialog window we can handle the application input and output. In PySymbian we have queries, notes and much more. Below is a code example.

appuifw.query(u"GO","query")
 
appuifw.note(u"stop","info")

Menu & Exit

After every thing there leaves the two important aspects in our application they are

Access To The Left Soft Key

Access To The Right Soft Key

We can use the the left soft key in our application to access the options or the application menus. In PyS60, we can do as following:

appuifw.app.menu=[(u"menu1",callback_1),
(u"menu2",callback_2)]

The right soft key in our Python application is used to exit our application. In PyS60, we can do it as:

appuifw.exit_key_handler = function

where function is a callback function that is called when the left key is pressed.

Helpful Links

95 page views in the last 30 days.
×