Professional Documents
Culture Documents
A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013
Outline
• Introduction
• Python
• Kivy
• Demos
• Limitations
• Credits
www.DLR.de • Chart 3 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013
Me
Scientist,
Head of department
Founder,
CEO
Enthusiastic about
Python
www.DLR.de • Chart 4 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013
DLR
German Aerospace Center
− Research Institution
− Space Agency
− Project Management Agency
www.DLR.de • Chart 5 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013
Lampoldshausen
Stuttgart
Augsburg
Oberpfaffenhofen
Weilheim
www.DLR.de • Chart 6 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013
Python
Python
def faculty(x):
if x > 1:
return x * faculty(x - 1)
else:
return 1
www.DLR.de • Chart 8 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013
Kivy
www.DLR.de • Chart 10 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013
Kivy
• Platform-independent Python-Framework
• Available for
• Android
• iOS
• Meego
• Windows kivy.org
• Linux
• OSX
• (Raspberry Pi)
Kivy Basics
Kivy Software
• Documentation: http://kivy.org/docs
class HelloApp(App):
def build(self):
return Button(text='Hello Berlin')
HelloApp().run()
www.DLR.de • Chart 14 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013
www.DLR.de • Chart 15 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013
class HelloApp(App):
pass
#:kivy 1.0
Button:
text: ‘Hello Berlin’
www.DLR.de • Chart 17 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013
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()
www.DLR.de • Chart 18 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013
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"
www.DLR.de • Chart 19 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013
Pong
Example
Hardware = autoclass('org.renpy.android.Hardware')
print 'DPI is', Hardware.getDPI()
www.DLR.de • Chart 21 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013
Packaging
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
Demos
www.DLR.de • Chart 24 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013
Kivy Showcase
www.DLR.de • Chart 25 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013
Kivy Pictures
www.DLR.de • Chart 26 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013
MQTT Client
www.DLR.de • Folie 29 mobile.cologne > Andreas Schreiber • Plattformübergreifende Apps entwickeln mit Kivy und Python > 08.11.2012
Other Examples…
iOS-App Deflectouch
https://itunes.apple.com/de/app/deflectouch/id505729681
iOS/Android-App ProcessCraft
https://itunes.apple.com/gb/app/processcraft/id526377075
http://showgen.com
www.DLR.de • Chart 37 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013
Limitations
www.DLR.de • Chart 38 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013
Porting to Raspberry Pi
• Useful for small/cheap standalone systems
• Founded via Crowdsourcing (bountysource.com)
www.DLR.de • Chart 39 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013
Credits
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, …
Andreas Schreiber
Twitter: @onyame
http://www.dlr.de/sc