SlideShare uma empresa Scribd logo
1 de 3
Baixar para ler 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 off 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.]
                                                       • floating 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            floats floating 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 defines 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 first line of code, we import the appuifw
a Nokia (S60) phone:                               module, which handles user interface elements
                                                   such as text input fields and popup notes.
  • Download the Installation files, you will find
     them at SourceForge’s PyS60 project page, In the second line of code, we create a single-field
     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 definitive 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 stuff you
tips; I will explain certain features practically. will interface with your phone in any case.

                                                            • note - popup notes
3      PyS60: your first program
This program consists of three lines of code; I will        • query - single-field input dialog
explain what each line does, but first what result
do we want from the program???                              • multi-query - two-field text input dialog

 1. We want it to display a text input field; a place        • popup menu - simple menu
    where the phone’s user can type in stuff!

 2. Display a pop-up note that says somethig like           • selection list - simple list with find pane (like
    ”Greetings from:” followed by whatever the                a search)
    user typed into the input field.
                                                            • multi-selection list - list to make the multiple
The code is:                                                  selections


                                                       2
Example 1:          Text input field 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 first 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-file dialog. The dialog
                                                can include some instruction text that is passed as
A module is a file 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 off 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 first 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

Mais conteúdo relacionado

Mais procurados

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
 
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
 
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
 

Mais procurados (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
 

Destaque

Destaque (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
 

Semelhante a 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
 
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
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to pythonMohammed Rafi
 
Final presentation on python
Final presentation on pythonFinal presentation on python
Final presentation on pythonRaginiJain21
 
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
 

Semelhante a 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
 

Último

Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 

Último (20)

Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 

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 off 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.] • floating 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 floats floating 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 defines 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 first line of code, we import the appuifw a Nokia (S60) phone: module, which handles user interface elements such as text input fields and popup notes. • Download the Installation files, you will find them at SourceForge’s PyS60 project page, In the second line of code, we create a single-field 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 definitive 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 stuff you tips; I will explain certain features practically. will interface with your phone in any case. • note - popup notes 3 PyS60: your first program This program consists of three lines of code; I will • query - single-field input dialog explain what each line does, but first what result do we want from the program??? • multi-query - two-field text input dialog 1. We want it to display a text input field; a place • popup menu - simple menu where the phone’s user can type in stuff! 2. Display a pop-up note that says somethig like • selection list - simple list with find pane (like ”Greetings from:” followed by whatever the a search) user typed into the input field. • multi-selection list - list to make the multiple The code is: selections 2
  • 3. Example 1: Text input field 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 first 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-file dialog. The dialog can include some instruction text that is passed as A module is a file 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 off 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 first 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