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
Tweet

More Decks by Ben Rousch

Other Decks in Programming

Transcript

  1. Kivy
    Multitouch for desktop and mobile with Python

    View Slide

  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

    View Slide

  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!

    View Slide

  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 )

    View Slide

  5. Recap: How can we fix that?
    ● Let's program for on
    ● 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!

    View Slide

  6. How to:
    Program for Android with Python
    ● Scripting Layer for Android (SL4A)
    ● android-python27

    View Slide

  7. How to:
    Program in Python on Android
    ● Scripting Layer for Android (SL4A)
    ● BotBrew for Android
    ● Linux on Android

    View Slide

  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!

    View Slide

  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

    View Slide

  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.

    View Slide

  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

    View Slide

  12. SayThis Tutorial


    View Slide

  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

    View Slide

  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

    View Slide

  15. Pyjnius
    ● JNI wrapper
    ● to allow access to Java classes
    ● from Python

    View Slide

  16. Pyjnius Example

    View Slide

  17. Pyjnius in SayThis : Media Volume

    View Slide

  18. Pyjnius in SayThis : TTS

    View Slide

  19. Editing Kivy Apps on Android
    ● Kivy Launcher
    ○ Touchtracer
    ○ OnDeviceDemo
    ● Replace SayThis with OnDeviceDemo

    View Slide

  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

    View Slide

  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

    View Slide

  22. Kivy Community
    ● Active IRC channel with core devs
    ● Programming Contest (done)

    RaspberryPi Bounty

    Python3 PSF Grant

    View Slide

  23. For More About Kivy
    Kivy Website
    Kivy Wiki
    Kivy on Github
    Kivy Users Google Group
    Kivy Development Google Group
    #kivy on Freenode (IRC)

    View Slide

  24. My Resources
    ● SayThis Tutorial Github Repo
    (grdevday2013 branch)

    View Slide