SlideShare a Scribd company logo
Pycon 2016
Developing Apps for Android and Other
Platforms with Kivy and Python
Pushpendra Tiwari
Outline
 Introduction
 Python
 Kivy
 Limitations
 Credits
Python
Python
 General-purpose, high-level programming
language
 Object-oriented, aspect-oriented, functional
 Dynamic type system
 Easy-to-learn with clear and expressive syntax
def faculty(x): if x > 1:
return x * faculty(x - 1) else:
return 1
Python on Mobile Devices
Early Mobile Development with
Python
 PyS60 for Symbian
 Python CE for Windows Mobile
Current Mobile Development
with Python
• Scripting Layer for Android
(SL4A)
• Python for Android (Py4A)
• PySide / Qt for Android
• WinRT / IronPython for
Windows 8
• Kivy…
Kivy
Kivy
 Platform-independent Python-
Framework
 Available for
 Android
 iOS
 Meego
 Windows
 Linux
 OSX
 (Raspberry Pi)
 Development in Python on all
platforms
 Not emulated!
kivy.org
Kivy Basics
 Framework for Natural User Interfaces
(NUI)
 Touchscreens / Multi-Touch
 GPU accelerated graphics
• Based on OpenGL ES 2.0
 Suitable for prototypes as well as products
• Porting to new platforms is easy
Kivy Software
 Open Source (LGPL), 7 Core developer
• Source code: https://github.com/kivy
• Documentation: http://kivy.org/docs
• Kivy on Google Play:
https://play.google.com/store/apps/details?id=org.kivy.pygame
Kivy says Hello!
from kivy.app import App
from kivy.uix.button import Button
class HelloApp(App): def build(self):
return Button(text='Hello Berlin')
HelloApp().run()
Developing apps with Kivy
Development with Kivy
 Python for widgets, input, program logic
• Language KV for layout und graphics
• Cython for low-level access to graphic routines
“Hello Berlin” with KV
from kivy.app import App
class HelloApp(App): pass
HelloApp().run()
#:kivy 1.0
Button:
text: ‘Hello Berlin’
File hello.kv
defines root widget
Example: Pong
import kivy
from kivy.app import App
from kivy.uix.widget import Widget
class PongGame(Widget): pass
class PongApp(App): def
build(self):
return PongGame()
if name == ' main ':
PongApp().run()
Pong Graphics
#:kivy 1.6.0
<PongGame>:
canvas:
Rectangle:
pos: self.center_x - 5, 0
size: 10, self.height
Label:
font_size: 70
center_x: root.width / 4 top: root.top
- 50 text: "0"
Label:
font_size: 70
center_x: root.width * 3 / 4 top:
root.top - 50
text: "0"
Pong
Full example: http://kivy.org/docs/tutorials/pong.html
Accessing Java Classes from Python
 Smartphones have many APIs
 Camera, Compass, Contacts, Location, …
 Access from Python via PyJNIus
• https://github.com/kivy/pyjnius
• Implemented with JNI and Java reflection
Example
from jnius import autoclass
Hardware = autoclass('org.renpy.android.Hardware')
print 'DPI is', Hardware.getDPI()
Packaging
 Creating packages for Windows, OSX, Android und iOS:
http://kivy.org/docs/guide/packaging.html
Build Tools
Tool chain
 Python-for-android
 Cross compiler for ARM
 Android SDK & NDK
 Python and some Python packages
Buildozer
• Hides the complexity: Downloads, compiles, packages Kivy source code
• https://github.com/kivy/buildozer
% buildozer android debug deploy run
Kivy Showcase
Limitations
Missing, but Planned (or In Progress)
User Interface Designer
 Design tool for Kivy Language KV
Abstraction of mobile APIs
• Platform-independent Python wrapper for platform APIs (Android, iOS,
Linux/Mac/Windows)
Porting to Raspberry Pi
• Useful for small/cheap standalone systems
Credits
Thanks to the Kivy developers
 Mathieu Virbel (@mathieuvirbel)
• Thomas Hansen (@hansent)
• Gabriel Pettier (@tshirtman)
• and many others
Questions?
Summary
 Kivy allows platform-independent development of apps
for Android, iOS, Meego, Windows, OSX and Linux
 Suitable for multi-touch and graphics applications, such
as kiosk systems, exhibits, games, …er Twitter:

More Related Content

PPTX
Kivy report
shobhit bhatnagar
 
PDF
Android Location and Maps
Jussi Pohjolainen
 
PPTX
Python/Flask Presentation
Parag Mujumdar
 
PDF
Introduction to kotlin
NAVER Engineering
 
PPTX
6-Python-Recursion PPT.pptx
Venkateswara Babu Ravipati
 
PDF
Tkinter Python Tutorial | Python GUI Programming Using Tkinter Tutorial | Pyt...
Edureka!
 
PPTX
Full Python in 20 slides
rfojdar
 
PPTX
Python Libraries and Modules
RaginiJain21
 
Kivy report
shobhit bhatnagar
 
Android Location and Maps
Jussi Pohjolainen
 
Python/Flask Presentation
Parag Mujumdar
 
Introduction to kotlin
NAVER Engineering
 
6-Python-Recursion PPT.pptx
Venkateswara Babu Ravipati
 
Tkinter Python Tutorial | Python GUI Programming Using Tkinter Tutorial | Pyt...
Edureka!
 
Full Python in 20 slides
rfojdar
 
Python Libraries and Modules
RaginiJain21
 

What's hot (20)

PDF
Python Crash Course
Haim Michael
 
PDF
How To Install Python Pip On Windows | Edureka
Edureka!
 
PDF
Python Installation Guide (1).pdf
SudhirSubramanya2
 
PPTX
PYTHON PPT.pptx
AbhishekMourya36
 
PPTX
Advanced Python : Decorators
Bhanwar Singh Meena
 
PPT
Tomcat
Venkat Pinagadi
 
PDF
Python libraries
Prof. Dr. K. Adisesha
 
PDF
Socket Programming In Python
didip
 
PDF
Python File Handling | File Operations in Python | Learn python programming |...
Edureka!
 
PPTX
Introduction to Makefile
Zakaria El ktaoui
 
PPTX
Flutter Intro
Vladimir Parfenov
 
PPTX
Introduction to Flutter
Apoorv Pandey
 
PPTX
Python decorators
Alex Su
 
PDF
React Native
vishal kumar
 
PDF
Introduction to python
Yi-Fan Chu
 
PPTX
Python - An Introduction
Swarit Wadhe
 
PDF
Android gps, location services, camera and sensors - Paramvir Singh
Paramvir Singh
 
PDF
Introduction to flutter
Wan Muzaffar Wan Hashim
 
PPTX
Django - Python MVC Framework
Bala Kumar
 
PPTX
Python 3 Programming Language
Tahani Al-Manie
 
Python Crash Course
Haim Michael
 
How To Install Python Pip On Windows | Edureka
Edureka!
 
Python Installation Guide (1).pdf
SudhirSubramanya2
 
PYTHON PPT.pptx
AbhishekMourya36
 
Advanced Python : Decorators
Bhanwar Singh Meena
 
Python libraries
Prof. Dr. K. Adisesha
 
Socket Programming In Python
didip
 
Python File Handling | File Operations in Python | Learn python programming |...
Edureka!
 
Introduction to Makefile
Zakaria El ktaoui
 
Flutter Intro
Vladimir Parfenov
 
Introduction to Flutter
Apoorv Pandey
 
Python decorators
Alex Su
 
React Native
vishal kumar
 
Introduction to python
Yi-Fan Chu
 
Python - An Introduction
Swarit Wadhe
 
Android gps, location services, camera and sensors - Paramvir Singh
Paramvir Singh
 
Introduction to flutter
Wan Muzaffar Wan Hashim
 
Django - Python MVC Framework
Bala Kumar
 
Python 3 Programming Language
Tahani Al-Manie
 
Ad

Viewers also liked (8)

PDF
Standalone Android Apps in Python
Baptiste Lagarde
 
ODP
Kivy - Python UI Library for Any Platform
Saurav Singhi
 
PDF
Creando Aplicaciones para Android con Kivy
Nahuel Defossé
 
ODP
Extracción de datos de páginas web con Python (webscraping)
Ernesto Crespo
 
ODP
Desarrollo de aplicaciones multiplataforma con python y Kivy
Ernesto Crespo
 
PDF
Remote Control your PC using Python and Kivy
Vengat Vasanth
 
PPTX
Sem5 2016 (1)
Sara Lázaro Martínez
 
Standalone Android Apps in Python
Baptiste Lagarde
 
Kivy - Python UI Library for Any Platform
Saurav Singhi
 
Creando Aplicaciones para Android con Kivy
Nahuel Defossé
 
Extracción de datos de páginas web con Python (webscraping)
Ernesto Crespo
 
Desarrollo de aplicaciones multiplataforma con python y Kivy
Ernesto Crespo
 
Remote Control your PC using Python and Kivy
Vengat Vasanth
 
Sem5 2016 (1)
Sara Lázaro Martínez
 
Ad

Similar to Developing apps with Kivy (20)

PPTX
MOBILE APP DEVELOPMENT USING PYTHON
PriyadharshiniVS
 
PDF
How to Build Cross-Platform Mobile Apps Using Python
Andolasoft Inc
 
PDF
Developing Online Application with Kivy A Python Framework
ijtsrd
 
PDF
Run Your Java Code on Cloud Foundry - Andy Piper (Pivotal)
jaxLondonConference
 
PDF
Run your Java apps on Cloud Foundry
Andy Piper
 
PDF
iOS Development Survival Guide for the .NET Guy
Nick Landry
 
PDF
Ionic App Platform Overview
Ionic Framework
 
PPTX
Ignite your app development with Angular, NativeScript and Firebase
Jen Looper
 
PPTX
Course overview 1
Michael Shrove
 
PDF
What's the best GUI library for Python.pdf
OnGraph Technologies
 
PDF
Hyperloop
Conny Svensson
 
PPTX
.NET Innovations and Improvements
Jeff Chu
 
PPTX
voice recognition security system ppt
Nitesh Dubey
 
PDF
iOS Development - Offline Class for Jasakomer
Andri Yadi
 
ODP
PyQt Application Development On Maemo
achipa
 
PPTX
Xamarin Open House talk - Sela Group - Ofir Makmal
Ofir Makmal
 
PPTX
XCUITest for iOS App Testing and how to test with Xcode
pCloudy
 
PDF
Connected Tizen: Bringing Tizen to Your Connected Devices Using the Yocto Pro...
Samsung Open Source Group
 
PDF
Visual Studio 2017 Launch Event
James Montemagno
 
PPTX
Recent Developments in Free Medical Imaging Software
Andrew Crabb
 
MOBILE APP DEVELOPMENT USING PYTHON
PriyadharshiniVS
 
How to Build Cross-Platform Mobile Apps Using Python
Andolasoft Inc
 
Developing Online Application with Kivy A Python Framework
ijtsrd
 
Run Your Java Code on Cloud Foundry - Andy Piper (Pivotal)
jaxLondonConference
 
Run your Java apps on Cloud Foundry
Andy Piper
 
iOS Development Survival Guide for the .NET Guy
Nick Landry
 
Ionic App Platform Overview
Ionic Framework
 
Ignite your app development with Angular, NativeScript and Firebase
Jen Looper
 
Course overview 1
Michael Shrove
 
What's the best GUI library for Python.pdf
OnGraph Technologies
 
Hyperloop
Conny Svensson
 
.NET Innovations and Improvements
Jeff Chu
 
voice recognition security system ppt
Nitesh Dubey
 
iOS Development - Offline Class for Jasakomer
Andri Yadi
 
PyQt Application Development On Maemo
achipa
 
Xamarin Open House talk - Sela Group - Ofir Makmal
Ofir Makmal
 
XCUITest for iOS App Testing and how to test with Xcode
pCloudy
 
Connected Tizen: Bringing Tizen to Your Connected Devices Using the Yocto Pro...
Samsung Open Source Group
 
Visual Studio 2017 Launch Event
James Montemagno
 
Recent Developments in Free Medical Imaging Software
Andrew Crabb
 

Recently uploaded (20)

PDF
Biological Classification Class 11th NCERT CBSE NEET.pdf
NehaRohtagi1
 
PPTX
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
PDF
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
PPTX
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
PPTX
CDH. pptx
AneetaSharma15
 
PPTX
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
PPTX
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 
PPTX
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
PPTX
Gupta Art & Architecture Temple and Sculptures.pptx
Virag Sontakke
 
PDF
Virat Kohli- the Pride of Indian cricket
kushpar147
 
DOCX
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
PPTX
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
PPTX
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
PPTX
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
DOCX
Modul Ajar Deep Learning Bahasa Inggris Kelas 11 Terbaru 2025
wahyurestu63
 
PPTX
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
PPTX
Five Point Someone – Chetan Bhagat | Book Summary & Analysis by Bhupesh Kushwaha
Bhupesh Kushwaha
 
PPTX
An introduction to Prepositions for beginners.pptx
drsiddhantnagine
 
PPTX
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
PPTX
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 
Biological Classification Class 11th NCERT CBSE NEET.pdf
NehaRohtagi1
 
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
CDH. pptx
AneetaSharma15
 
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
Gupta Art & Architecture Temple and Sculptures.pptx
Virag Sontakke
 
Virat Kohli- the Pride of Indian cricket
kushpar147
 
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
Modul Ajar Deep Learning Bahasa Inggris Kelas 11 Terbaru 2025
wahyurestu63
 
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
Five Point Someone – Chetan Bhagat | Book Summary & Analysis by Bhupesh Kushwaha
Bhupesh Kushwaha
 
An introduction to Prepositions for beginners.pptx
drsiddhantnagine
 
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 

Developing apps with Kivy

  • 1. Pycon 2016 Developing Apps for Android and Other Platforms with Kivy and Python Pushpendra Tiwari
  • 2. Outline  Introduction  Python  Kivy  Limitations  Credits
  • 4. Python  General-purpose, high-level programming language  Object-oriented, aspect-oriented, functional  Dynamic type system  Easy-to-learn with clear and expressive syntax def faculty(x): if x > 1: return x * faculty(x - 1) else: return 1
  • 5. Python on Mobile Devices Early Mobile Development with Python  PyS60 for Symbian  Python CE for Windows Mobile Current Mobile Development with Python • Scripting Layer for Android (SL4A) • Python for Android (Py4A) • PySide / Qt for Android • WinRT / IronPython for Windows 8 • Kivy…
  • 7. Kivy  Platform-independent Python- Framework  Available for  Android  iOS  Meego  Windows  Linux  OSX  (Raspberry Pi)  Development in Python on all platforms  Not emulated! kivy.org
  • 8. Kivy Basics  Framework for Natural User Interfaces (NUI)  Touchscreens / Multi-Touch  GPU accelerated graphics • Based on OpenGL ES 2.0  Suitable for prototypes as well as products • Porting to new platforms is easy
  • 9. Kivy Software  Open Source (LGPL), 7 Core developer • Source code: https://github.com/kivy • Documentation: http://kivy.org/docs • Kivy on Google Play: https://play.google.com/store/apps/details?id=org.kivy.pygame
  • 10. Kivy says Hello! from kivy.app import App from kivy.uix.button import Button class HelloApp(App): def build(self): return Button(text='Hello Berlin') HelloApp().run()
  • 12. Development with Kivy  Python for widgets, input, program logic • Language KV for layout und graphics • Cython for low-level access to graphic routines
  • 13. “Hello Berlin” with KV from kivy.app import App class HelloApp(App): pass HelloApp().run() #:kivy 1.0 Button: text: ‘Hello Berlin’ File hello.kv defines root widget
  • 14. Example: Pong import kivy from kivy.app import App from kivy.uix.widget import Widget class PongGame(Widget): pass class PongApp(App): def build(self): return PongGame() if name == ' main ': PongApp().run()
  • 15. Pong Graphics #:kivy 1.6.0 <PongGame>: canvas: Rectangle: pos: self.center_x - 5, 0 size: 10, self.height Label: font_size: 70 center_x: root.width / 4 top: root.top - 50 text: "0" Label: font_size: 70 center_x: root.width * 3 / 4 top: root.top - 50 text: "0"
  • 17. Accessing Java Classes from Python  Smartphones have many APIs  Camera, Compass, Contacts, Location, …  Access from Python via PyJNIus • https://github.com/kivy/pyjnius • Implemented with JNI and Java reflection Example from jnius import autoclass Hardware = autoclass('org.renpy.android.Hardware') print 'DPI is', Hardware.getDPI()
  • 18. Packaging  Creating packages for Windows, OSX, Android und iOS: http://kivy.org/docs/guide/packaging.html
  • 19. Build Tools Tool chain  Python-for-android  Cross compiler for ARM  Android SDK & NDK  Python and some Python packages Buildozer • Hides the complexity: Downloads, compiles, packages Kivy source code • https://github.com/kivy/buildozer % buildozer android debug deploy run
  • 22. Missing, but Planned (or In Progress) User Interface Designer  Design tool for Kivy Language KV Abstraction of mobile APIs • Platform-independent Python wrapper for platform APIs (Android, iOS, Linux/Mac/Windows) Porting to Raspberry Pi • Useful for small/cheap standalone systems
  • 23. Credits Thanks to the Kivy developers  Mathieu Virbel (@mathieuvirbel) • Thomas Hansen (@hansent) • Gabriel Pettier (@tshirtman) • and many others
  • 24. Questions? Summary  Kivy allows platform-independent development of apps for Android, iOS, Meego, Windows, OSX and Linux  Suitable for multi-touch and graphics applications, such as kiosk systems, exhibits, games, …er Twitter: