Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Kivy Intro and Tutorial (GRDevDay 2013)

Kivy Intro and Tutorial (GRDevDay 2013)

An introduction to Kivy including a tutorial to make an Android app.

Ben Rousch

March 02, 2013

More Decks by Ben Rousch

Other Decks in Programming


  1. Kivy Multitouch for desktop and mobile with Python

  2. TL;DR • Why Python on Android and for Android? •

    What is Kivy? • Kivy application showcase • Make a desktop Kivy application • Turn it into an Android app • Edit Kivy app on Android • More awesome Kivy tools
  3. Who am I? By day I am the reclusive entirety

    of the IT department for Van Dam Iron Works. By night I stalk the mean streets of Grand Rapids, Michigan as a serial user group organizer. I am Ben Rousch!
  4. Recap: Ben, WTF are you doing? • Tablets are becoming

    more common. • Some people only own a tablet. • Some schools are handing out tablets. • This is bad for learning to program. ( Rushkoff: Program or Be Programmed )
  5. Recap: How can we fix that? • Let's program for

    <device> on <device> • iOS is a lost cause. Too locked down. • Let's program for Android on Android ◦ AIDE - Android Java IDE ◦ TerminalIDE • But I don't like Java. • I want to use Python!
  6. How to: Program for Android with Python • Scripting Layer

    for Android (SL4A) • android-python27
  7. How to: Program in Python on Android • Scripting Layer

    for Android (SL4A) • BotBrew for Android • Linux on Android
  8. How to: Program in Python for Android on Android •

    Scripting Layer for Android (SL4A)? ◦ Clumsy project creation and usage ◦ Device compatibility issues ◦ Limited access to underlying Android • Linux on Android? ◦ No Android SDK for ARM ◦ High resource demands • android-python27 + AIDE? ◦ Annoying Eclipse project to create ◦ One person team ◦ Device compatibility issues ◦ Limited access to underlying Android • Kivy!
  9. What is Kivy (Officially)? • Open source • Python library

    • for rapid development of applications • that make use of innovative user interfaces • such as multi-touch apps
  10. What is Kivy (To Me)? • Python • GUI and

    application framework • that works on all of my favorite platforms • (also some other platforms), • which can make Android apps • testable on the desktop w/o the emulator, • can be modified right on the device, • and it's run by a mature and stable team.
  11. Kivy Showcase • Yeco - A touch controller for Ableton

    Live • kivyMaps - cross-platform maps with Kivy • Particle Panda - particle effects generator • NORBERT - ROBE Lighting showcase • KiPyCalc - Programmable calculator • Kivy Demo Site
  12. SayThis Tutorial • <Demo SayThis on Desktop> • <Demo SayThis

    on Phone>
  13. Let's Make an Application 1. Minimum app 2. Add background

    image (missing) 3. Really add background image 4. Make background image fit window 5. Add GUI elements 6. Resize elements 7. Adding padding and spacing 8. Change font size 9. Add popup action to button 10. Add TTS capability 11. Show inspector
  14. Let's Make it an Android App 1. Install Python for

    Android 2. Compile Python for Android 3. Add Android resources (icon, splash screen) 4. Compile APK 5. Talk about pyjnius
  15. Pyjnius • JNI wrapper • to allow access to Java

    classes • from Python
  16. Pyjnius Example

  17. Pyjnius in SayThis : Media Volume

  18. Pyjnius in SayThis : TTS

  19. Editing Kivy Apps on Android • Kivy Launcher ◦ Touchtracer

    ◦ OnDeviceDemo • Replace SayThis with OnDeviceDemo
  20. What's Left? • Create Kivy app on Android • Kivy-specific

    on-device IDE • Version control: git • Make it easier to build for all platforms • Platform abstraction layer
  21. More Kivy Stuff Coming Soon • Inspector: python main.py -m

    inspect • Remote Python Shell on Android (pyjnius) • Buildozer: create packages for all platforms • Kivy Designer: WYSIWYG designer and IDE • Plyer: platform abstraction layer
  22. Kivy Community • Active IRC channel with core devs •

    Programming Contest (done) • RaspberryPi Bounty • Python3 PSF Grant
  23. For More About Kivy Kivy Website Kivy Wiki Kivy on

    Github Kivy Users Google Group Kivy Development Google Group #kivy on Freenode (IRC)
  24. My Resources • SayThis Tutorial Github Repo (grdevday2013 branch)