SlideShare a Scribd company logo
1 of 3
Download to read offline
Building mobile applications with Python over
                  X-platforms: Part I
                                           Victor Miclovich
                                            Appfrica Labs
                                    victor.miclovich@appfrica.org
                                          September 14, 2009


Abstract                                             converted into numbers. A screen lights up a
                                                     particular coordinate (pixel) and construct an
This paper exists just because itā€™s much more fun image with more advanced image analysis and
to build something than to actually learn theoretic signal processing (weā€™ll cover this if weā€™ve got time).
crap, right? What I try to put oļ¬€ in this article is
just a way to learn Python interactively.              Below is a list of data types we can expect to
We shall be looking at the Python basics and encounter in Python:
Graphical User Interfaces ===> [look out for other
papers on Messaging, video interaction, camera         ā€¢ integers (int)
APIs, networking, and many other topics.]
                                                       ā€¢ ļ¬‚oating point (float)

                                                                 ā€¢ strings or text (str)
1     Python basics
                                                             Data types are quite easy to understand; we shall
Programming languages are a way in which we can              discuss ways we can handle this kind of data
talk and make computers do things for us in a log-           throught mathematical processes like addition,
ical (or destructive) way. Like any language (both           subtraction and division.
natural and formal), thereā€™s got to be a grammar
of some kind, doesnā€™t there? The grammar in this
case shall be known as a syntax .                            Integers integers are numbers that donā€™t have any
Letā€™s think about the human language (English,                   fractional parts! This refers to numbers like
French, ...) for a while. We see that thereā€™s a lot              1, 2, 3, 4, ..., etc.
of structure, especially, logical structure. Sentences
are usually phased in particular ways that convey            ļ¬‚oats ļ¬‚oating point are numbers with fractional
the meaning a speaker intends to give the intended               parts or simply decimal numbers
audience. Isnā€™t that just so right? I think so. This         Strings Strings are just textual parts of data; they
is what we call having semantics. I want you                     could be alphabetic symbols, numbers or al-
think of this as just meaning of something.                      phanumeric

1.1    Data types
                                                             2      Python for Symbian OS
Data types deļ¬nes the quality of ā€thingsā€ a
computer has to interface with. This is includes             The Symbian OS is a mobile operating system.
things like numbers and text.      In essence, a             Many such installations are found in many modern
computer will only interact with numbers (binary             Nokia, Samsung, LG phones. We shall be using
i.e. {0, 1}). Images will in any case, always be             Python to illustrate the design and development


                                                         1
of mobile applications. And while we are at it,     import appuifw
ready yourselves with either a phone emulator or name = appuifw.query(u"Type your
the actual phone                                   name:","text")
                                                   appuifw.note(u"Hello World! Greetings
  We shall use Nokia smartphones as our platform from: "+str(name),"info")
for learning Python in a more interesting way.
Below are instructions on how to install Python in In the ļ¬rst line of code, we import the appuifw
a Nokia (S60) phone:                               module, which handles user interface elements
                                                   such as text input ļ¬elds and popup notes.
  ā€¢ Download the Installation ļ¬les, you will ļ¬nd
     them at SourceForgeā€™s PyS60 project page, In the second line of code, we create a single-ļ¬eld
     http://sourceforge.net/projects/pys60. Get a dialog using the query() function (think of this
     recent and compartable version with your as f (x, y)) which is found inside the appuifw
     phone.                                        module with two parameters: label and type. The
                                                       label is the text we want printed out and type
        ā€“ the PyS60 interpreter. (these are usually
                                                       refers to whether the text should appear as a
          signed and have a .sis extension).
                                                       warning popup, info popup, danger popup or some
         ā€“ the pythonscript shell (there are version other deļ¬nitive standard. You may have noticed a
           numbers included, you should be mindful certain character u that we placed before our string
           of that).                                   because the only text our phone understands is
                                                       unicode: a standard way by which textual infor-
    ā€¢ Download the Python SDK (software develop-
                                                       mation is portrayed and that has internationalized
      ment kit); this is is at http://forum.nokia.com.
                                                       support (this means many natural languages are
    ā€¢ A phone memory/data card (you will need a supported e.g. Russian, Chinese, Arabic, etc.).
      place to store the programs you run for your
      phone).                                             Other types are supported, not just ā€textā€ type.
                                                       They include ā€numberā€, ā€dateā€, ā€timeā€, ā€queryā€,
    ā€¢ You will need a computer that runs either Win- and ā€codeā€.
      dows, Linux or Mac OS X.

    ā€¢ A USB cable or bluetooth to connect with the         Introduction to GUIs
      computer.
                                                   This is the easiest thing you will learn about in
As we move on, you will experience the use of both PyS60 (our code name for Python in mobile). In
your phone and computer; you can search for more this section I demonstrate the following stuļ¬€ you
tips; I will explain certain features practically. will interface with your phone in any case.

                                                            ā€¢ note - popup notes
3      PyS60: your ļ¬rst program
This program consists of three lines of code; I will        ā€¢ query - single-ļ¬eld input dialog
explain what each line does, but ļ¬rst what result
do we want from the program???                              ā€¢ multi-query - two-ļ¬eld text input dialog

 1. We want it to display a text input ļ¬eld; a place        ā€¢ popup menu - simple menu
    where the phoneā€™s user can type in stuļ¬€!

 2. Display a pop-up note that says somethig like           ā€¢ selection list - simple list with ļ¬nd pane (like
    ā€Greetings from:ā€ followed by whatever the                a search)
    user typed into the input ļ¬eld.
                                                            ā€¢ multi-selection list - list to make the multiple
The code is:                                                  selections


                                                       2
Example 1:          Text input ļ¬eld and Dialogs, Menus, and Selection
popup note                                                 lists
Native UI (User Interface) elments that PyS60 of-
fers are accessible through a module called: ap-           Single-Field Dialog: query
plication user interface framework which in code           Its syntax   is   query(label,type[, initial
is written appuifw. It is an interface to the S60          value])
UI application framework that takes care of all UI         Code hack:
functionalities on the S60 platform. But ļ¬rst an
introduction to what a module is in Python.                appuifw.query(u"Type a word:    ", "text",
                                                           u"Foo")
Python lesson: module                           This fuction shows a single-ļ¬le dialog. The dialog
                                                can include some instruction text that is passed as
A module is a ļ¬le that contains a collection of
                                                a string (by putting the u in front of the string ā€ā€)
related functions and data grouped together.
PyS60 comes with a rich set of modules, for
example messaging to handle SMS functionalites, Exercise
camera for taking photos, and appuifw, which The aim of this section is to allow you guys to prac-
provides ready-to-use UI elements.              tice! You can practice with your phone or emulator.

   The modulesā€™ contents are described in detail in         import appuifw
the Python library reference and Python for S60            appuifw.query(u"Type a   word:","text")
API documentation.                                         appuifw.query(u"Type a   number:","number")
To use a module (group of functionalities or abili-        appuifw.query(u"Type a   date:","date")
ties) in your code, it must be imported at the be-         appuifw.query(u"Type a   time:","time")
ginning of the script, for example:                        appuifw.query(u"Type a   password:" "code")
                                                           appuifw.query(u"Do you   like
import appuifw                                             PyS60","query")

And to pick oļ¬€ functionalities from your module,
we write the module name, a dot and then name of
function that we want!

appuifw.query(label,type)

Here, appuifw is the module name and query is
the function you want to use.
You may import many modules using a single im-
port statement:

import appuifw, e32 This imports two modules:
appuifw and e32.

In the ļ¬rst example several sections ago we used the
query() and note() functions... (remember just like
f (x)) and the functions belong to appuifw module.
These functions generate UI elements, dialogs, that
are displayed on the when the PyS60 interpreter
executes the script. They become visible on the
phone screen as soon as the corresponding Python
function is called.

                                                       3

More Related Content

What's hot

Note on a Mobile Security... or How the Brave Permutation Saved a Naughty Key...
Note on a Mobile Security... or How the Brave Permutation Saved a Naughty Key...Note on a Mobile Security... or How the Brave Permutation Saved a Naughty Key...
Note on a Mobile Security... or How the Brave Permutation Saved a Naughty Key...Petr Dvorak
Ā 
Python Programming
Python ProgrammingPython Programming
Python Programmingshahid sultan
Ā 
WEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTHWEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTHBhavsingh Maloth
Ā 
Web Programming UNIT VIII notes
Web Programming UNIT VIII notesWeb Programming UNIT VIII notes
Web Programming UNIT VIII notesBhavsingh Maloth
Ā 
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYAChapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYAMaulik Borsaniya
Ā 
Chapter 8 getting started with python
Chapter 8 getting started with pythonChapter 8 getting started with python
Chapter 8 getting started with pythonPraveen M Jigajinni
Ā 
PYTHON CURRENT TREND APPLICATIONS- AN OVERVIEW
PYTHON CURRENT TREND APPLICATIONS- AN OVERVIEWPYTHON CURRENT TREND APPLICATIONS- AN OVERVIEW
PYTHON CURRENT TREND APPLICATIONS- AN OVERVIEWEditorIJAERD
Ā 
Python Tutorial
Python TutorialPython Tutorial
Python TutorialAkramWaseem
Ā 
Mastering python lesson1
Mastering python lesson1Mastering python lesson1
Mastering python lesson1Ruth Marvin
Ā 
Python presentation by Monu Sharma
Python presentation by Monu SharmaPython presentation by Monu Sharma
Python presentation by Monu SharmaMayank Sharma
Ā 
Python quick guide1
Python quick guide1Python quick guide1
Python quick guide1Kanchilug
Ā 
1. python programming
1. python programming1. python programming
1. python programmingsreeLekha51
Ā 
C++0x :: Introduction to some amazing features
C++0x :: Introduction to some amazing featuresC++0x :: Introduction to some amazing features
C++0x :: Introduction to some amazing featuresChristian Perone
Ā 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to PythonDrMohammed Qassim
Ā 
Python - Lesson 1
Python - Lesson 1Python - Lesson 1
Python - Lesson 1Andrew Frangos
Ā 
Python intro
Python introPython intro
Python introPiyush rai
Ā 

What's hot (17)

Python tutorial
Python tutorialPython tutorial
Python tutorial
Ā 
Note on a Mobile Security... or How the Brave Permutation Saved a Naughty Key...
Note on a Mobile Security... or How the Brave Permutation Saved a Naughty Key...Note on a Mobile Security... or How the Brave Permutation Saved a Naughty Key...
Note on a Mobile Security... or How the Brave Permutation Saved a Naughty Key...
Ā 
Python Programming
Python ProgrammingPython Programming
Python Programming
Ā 
WEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTHWEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTH
Ā 
Web Programming UNIT VIII notes
Web Programming UNIT VIII notesWeb Programming UNIT VIII notes
Web Programming UNIT VIII notes
Ā 
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYAChapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
Ā 
Chapter 8 getting started with python
Chapter 8 getting started with pythonChapter 8 getting started with python
Chapter 8 getting started with python
Ā 
PYTHON CURRENT TREND APPLICATIONS- AN OVERVIEW
PYTHON CURRENT TREND APPLICATIONS- AN OVERVIEWPYTHON CURRENT TREND APPLICATIONS- AN OVERVIEW
PYTHON CURRENT TREND APPLICATIONS- AN OVERVIEW
Ā 
Python Tutorial
Python TutorialPython Tutorial
Python Tutorial
Ā 
Mastering python lesson1
Mastering python lesson1Mastering python lesson1
Mastering python lesson1
Ā 
Python presentation by Monu Sharma
Python presentation by Monu SharmaPython presentation by Monu Sharma
Python presentation by Monu Sharma
Ā 
Python quick guide1
Python quick guide1Python quick guide1
Python quick guide1
Ā 
1. python programming
1. python programming1. python programming
1. python programming
Ā 
C++0x :: Introduction to some amazing features
C++0x :: Introduction to some amazing featuresC++0x :: Introduction to some amazing features
C++0x :: Introduction to some amazing features
Ā 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
Ā 
Python - Lesson 1
Python - Lesson 1Python - Lesson 1
Python - Lesson 1
Ā 
Python intro
Python introPython intro
Python intro
Ā 

Viewers also liked

Mobile communities and innovation
Mobile communities and innovationMobile communities and innovation
Mobile communities and innovationVictor Miclovich
Ā 
Django Girls Mbale [victor's sessions]
Django Girls Mbale [victor's sessions]Django Girls Mbale [victor's sessions]
Django Girls Mbale [victor's sessions]Victor Miclovich
Ā 
Android Development Slides
Android Development SlidesAndroid Development Slides
Android Development SlidesVictor Miclovich
Ā 
Google devfest makerere university
Google devfest makerere universityGoogle devfest makerere university
Google devfest makerere universityVictor Miclovich
Ā 

Viewers also liked (7)

Mobile communities and innovation
Mobile communities and innovationMobile communities and innovation
Mobile communities and innovation
Ā 
Crowdmapping
CrowdmappingCrowdmapping
Crowdmapping
Ā 
Django Girls Mbale [victor's sessions]
Django Girls Mbale [victor's sessions]Django Girls Mbale [victor's sessions]
Django Girls Mbale [victor's sessions]
Ā 
Okfest
OkfestOkfest
Okfest
Ā 
Story spaces pitch
Story spaces pitchStory spaces pitch
Story spaces pitch
Ā 
Android Development Slides
Android Development SlidesAndroid Development Slides
Android Development Slides
Ā 
Google devfest makerere university
Google devfest makerere universityGoogle devfest makerere university
Google devfest makerere university
Ā 

Similar to Build Apps

Introduction to python for Beginners
Introduction to python for Beginners Introduction to python for Beginners
Introduction to python for Beginners Sujith Kumar
Ā 
Python_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptxPython_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptxlemonchoos
Ā 
Python Tutorial | Python Programming Language
Python Tutorial | Python Programming LanguagePython Tutorial | Python Programming Language
Python Tutorial | Python Programming Languageanaveenkumar4
Ā 
python programming.pptx
python programming.pptxpython programming.pptx
python programming.pptxKaviya452563
Ā 
intro.pptx (1).pdf
intro.pptx (1).pdfintro.pptx (1).pdf
intro.pptx (1).pdfANIKULSAIKH
Ā 
Socket programming-in-python
Socket programming-in-pythonSocket programming-in-python
Socket programming-in-pythonYuvaraja Ravi
Ā 
Python tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academyPython tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academyTIB Academy
Ā 
Cmpe202 01 Research
Cmpe202 01 ResearchCmpe202 01 Research
Cmpe202 01 Researchvladimirkorshak
Ā 
Presentation on python
Presentation on pythonPresentation on python
Presentation on pythonwilliam john
Ā 
Training report 1923-b.e-eee-batchno--intern-54 (1).pdf
Training report 1923-b.e-eee-batchno--intern-54 (1).pdfTraining report 1923-b.e-eee-batchno--intern-54 (1).pdf
Training report 1923-b.e-eee-batchno--intern-54 (1).pdfYadavHarshKr
Ā 
Python Course.docx
Python Course.docxPython Course.docx
Python Course.docxAdnanAhmad57885
Ā 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to pythonMohammed Rafi
Ā 
Python Programming Draft PPT.pptx
Python Programming Draft PPT.pptxPython Programming Draft PPT.pptx
Python Programming Draft PPT.pptxLakshmiNarayanaReddy48
Ā 
Final presentation on python
Final presentation on pythonFinal presentation on python
Final presentation on pythonRaginiJain21
Ā 
MODULE 1.pptx
MODULE 1.pptxMODULE 1.pptx
MODULE 1.pptxKPDDRAVIDIAN
Ā 
session5-Getting stated with Python.pdf
session5-Getting stated with Python.pdfsession5-Getting stated with Python.pdf
session5-Getting stated with Python.pdfAyushDutta32
Ā 
introduction of python in data science
introduction of python in data scienceintroduction of python in data science
introduction of python in data sciencebhavesh lande
Ā 

Similar to Build Apps (20)

Python Class 1
Python Class 1Python Class 1
Python Class 1
Ā 
Introduction to python for Beginners
Introduction to python for Beginners Introduction to python for Beginners
Introduction to python for Beginners
Ā 
Python_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptxPython_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptx
Ā 
Introduction python
Introduction pythonIntroduction python
Introduction python
Ā 
Python Tutorial | Python Programming Language
Python Tutorial | Python Programming LanguagePython Tutorial | Python Programming Language
Python Tutorial | Python Programming Language
Ā 
python programming.pptx
python programming.pptxpython programming.pptx
python programming.pptx
Ā 
intro.pptx (1).pdf
intro.pptx (1).pdfintro.pptx (1).pdf
intro.pptx (1).pdf
Ā 
Socket programming-in-python
Socket programming-in-pythonSocket programming-in-python
Socket programming-in-python
Ā 
Python tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academyPython tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academy
Ā 
Cmpe202 01 Research
Cmpe202 01 ResearchCmpe202 01 Research
Cmpe202 01 Research
Ā 
Presentation on python
Presentation on pythonPresentation on python
Presentation on python
Ā 
Python basic
Python basicPython basic
Python basic
Ā 
Training report 1923-b.e-eee-batchno--intern-54 (1).pdf
Training report 1923-b.e-eee-batchno--intern-54 (1).pdfTraining report 1923-b.e-eee-batchno--intern-54 (1).pdf
Training report 1923-b.e-eee-batchno--intern-54 (1).pdf
Ā 
Python Course.docx
Python Course.docxPython Course.docx
Python Course.docx
Ā 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
Ā 
Python Programming Draft PPT.pptx
Python Programming Draft PPT.pptxPython Programming Draft PPT.pptx
Python Programming Draft PPT.pptx
Ā 
Final presentation on python
Final presentation on pythonFinal presentation on python
Final presentation on python
Ā 
MODULE 1.pptx
MODULE 1.pptxMODULE 1.pptx
MODULE 1.pptx
Ā 
session5-Getting stated with Python.pdf
session5-Getting stated with Python.pdfsession5-Getting stated with Python.pdf
session5-Getting stated with Python.pdf
Ā 
introduction of python in data science
introduction of python in data scienceintroduction of python in data science
introduction of python in data science
Ā 

Recently uploaded

A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
Ā 
FULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | DelhiFULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | Delhisoniya singh
Ā 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
Ā 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
Ā 
WhatsApp 9892124323 āœ“Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 āœ“Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 āœ“Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 āœ“Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
Ā 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
Ā 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
Ā 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
Ā 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
Ā 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
Ā 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
Ā 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
Ā 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
Ā 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
Ā 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
Ā 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
Ā 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
Ā 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
Ā 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
Ā 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
Ā 

Recently uploaded (20)

A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
Ā 
FULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | DelhiFULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | Delhi
Ā 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
Ā 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
Ā 
WhatsApp 9892124323 āœ“Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 āœ“Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 āœ“Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 āœ“Call Girls In Kalyan ( Mumbai ) secure service
Ā 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
Ā 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
Ā 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
Ā 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
Ā 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
Ā 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Ā 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
Ā 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
Ā 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
Ā 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
Ā 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
Ā 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
Ā 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
Ā 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
Ā 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
Ā 

Build Apps

  • 1. Building mobile applications with Python over X-platforms: Part I Victor Miclovich Appfrica Labs victor.miclovich@appfrica.org September 14, 2009 Abstract converted into numbers. A screen lights up a particular coordinate (pixel) and construct an This paper exists just because itā€™s much more fun image with more advanced image analysis and to build something than to actually learn theoretic signal processing (weā€™ll cover this if weā€™ve got time). crap, right? What I try to put oļ¬€ in this article is just a way to learn Python interactively. Below is a list of data types we can expect to We shall be looking at the Python basics and encounter in Python: Graphical User Interfaces ===> [look out for other papers on Messaging, video interaction, camera ā€¢ integers (int) APIs, networking, and many other topics.] ā€¢ ļ¬‚oating point (float) ā€¢ strings or text (str) 1 Python basics Data types are quite easy to understand; we shall Programming languages are a way in which we can discuss ways we can handle this kind of data talk and make computers do things for us in a log- throught mathematical processes like addition, ical (or destructive) way. Like any language (both subtraction and division. natural and formal), thereā€™s got to be a grammar of some kind, doesnā€™t there? The grammar in this case shall be known as a syntax . Integers integers are numbers that donā€™t have any Letā€™s think about the human language (English, fractional parts! This refers to numbers like French, ...) for a while. We see that thereā€™s a lot 1, 2, 3, 4, ..., etc. of structure, especially, logical structure. Sentences are usually phased in particular ways that convey ļ¬‚oats ļ¬‚oating point are numbers with fractional the meaning a speaker intends to give the intended parts or simply decimal numbers audience. Isnā€™t that just so right? I think so. This Strings Strings are just textual parts of data; they is what we call having semantics. I want you could be alphabetic symbols, numbers or al- think of this as just meaning of something. phanumeric 1.1 Data types 2 Python for Symbian OS Data types deļ¬nes the quality of ā€thingsā€ a computer has to interface with. This is includes The Symbian OS is a mobile operating system. things like numbers and text. In essence, a Many such installations are found in many modern computer will only interact with numbers (binary Nokia, Samsung, LG phones. We shall be using i.e. {0, 1}). Images will in any case, always be Python to illustrate the design and development 1
  • 2. of mobile applications. And while we are at it, import appuifw ready yourselves with either a phone emulator or name = appuifw.query(u"Type your the actual phone name:","text") appuifw.note(u"Hello World! Greetings We shall use Nokia smartphones as our platform from: "+str(name),"info") for learning Python in a more interesting way. Below are instructions on how to install Python in In the ļ¬rst line of code, we import the appuifw a Nokia (S60) phone: module, which handles user interface elements such as text input ļ¬elds and popup notes. ā€¢ Download the Installation ļ¬les, you will ļ¬nd them at SourceForgeā€™s PyS60 project page, In the second line of code, we create a single-ļ¬eld http://sourceforge.net/projects/pys60. Get a dialog using the query() function (think of this recent and compartable version with your as f (x, y)) which is found inside the appuifw phone. module with two parameters: label and type. The label is the text we want printed out and type ā€“ the PyS60 interpreter. (these are usually refers to whether the text should appear as a signed and have a .sis extension). warning popup, info popup, danger popup or some ā€“ the pythonscript shell (there are version other deļ¬nitive standard. You may have noticed a numbers included, you should be mindful certain character u that we placed before our string of that). because the only text our phone understands is unicode: a standard way by which textual infor- ā€¢ Download the Python SDK (software develop- mation is portrayed and that has internationalized ment kit); this is is at http://forum.nokia.com. support (this means many natural languages are ā€¢ A phone memory/data card (you will need a supported e.g. Russian, Chinese, Arabic, etc.). place to store the programs you run for your phone). Other types are supported, not just ā€textā€ type. They include ā€numberā€, ā€dateā€, ā€timeā€, ā€queryā€, ā€¢ You will need a computer that runs either Win- and ā€codeā€. dows, Linux or Mac OS X. ā€¢ A USB cable or bluetooth to connect with the Introduction to GUIs computer. This is the easiest thing you will learn about in As we move on, you will experience the use of both PyS60 (our code name for Python in mobile). In your phone and computer; you can search for more this section I demonstrate the following stuļ¬€ you tips; I will explain certain features practically. will interface with your phone in any case. ā€¢ note - popup notes 3 PyS60: your ļ¬rst program This program consists of three lines of code; I will ā€¢ query - single-ļ¬eld input dialog explain what each line does, but ļ¬rst what result do we want from the program??? ā€¢ multi-query - two-ļ¬eld text input dialog 1. We want it to display a text input ļ¬eld; a place ā€¢ popup menu - simple menu where the phoneā€™s user can type in stuļ¬€! 2. Display a pop-up note that says somethig like ā€¢ selection list - simple list with ļ¬nd pane (like ā€Greetings from:ā€ followed by whatever the a search) user typed into the input ļ¬eld. ā€¢ multi-selection list - list to make the multiple The code is: selections 2
  • 3. Example 1: Text input ļ¬eld and Dialogs, Menus, and Selection popup note lists Native UI (User Interface) elments that PyS60 of- fers are accessible through a module called: ap- Single-Field Dialog: query plication user interface framework which in code Its syntax is query(label,type[, initial is written appuifw. It is an interface to the S60 value]) UI application framework that takes care of all UI Code hack: functionalities on the S60 platform. But ļ¬rst an introduction to what a module is in Python. appuifw.query(u"Type a word: ", "text", u"Foo") Python lesson: module This fuction shows a single-ļ¬le dialog. The dialog can include some instruction text that is passed as A module is a ļ¬le that contains a collection of a string (by putting the u in front of the string ā€ā€) related functions and data grouped together. PyS60 comes with a rich set of modules, for example messaging to handle SMS functionalites, Exercise camera for taking photos, and appuifw, which The aim of this section is to allow you guys to prac- provides ready-to-use UI elements. tice! You can practice with your phone or emulator. The modulesā€™ contents are described in detail in import appuifw the Python library reference and Python for S60 appuifw.query(u"Type a word:","text") API documentation. appuifw.query(u"Type a number:","number") To use a module (group of functionalities or abili- appuifw.query(u"Type a date:","date") ties) in your code, it must be imported at the be- appuifw.query(u"Type a time:","time") ginning of the script, for example: appuifw.query(u"Type a password:" "code") appuifw.query(u"Do you like import appuifw PyS60","query") And to pick oļ¬€ functionalities from your module, we write the module name, a dot and then name of function that we want! appuifw.query(label,type) Here, appuifw is the module name and query is the function you want to use. You may import many modules using a single im- port statement: import appuifw, e32 This imports two modules: appuifw and e32. In the ļ¬rst example several sections ago we used the query() and note() functions... (remember just like f (x)) and the functions belong to appuifw module. These functions generate UI elements, dialogs, that are displayed on the when the PyS60 interpreter executes the script. They become visible on the phone screen as soon as the corresponding Python function is called. 3