Kivy Cookbook

Book description

Enhance your skills in developing multi-touch applications with Kivy

About This Book

  • Create most diverse apps and learn how to distribute them with the help of the Kivy framework
  • Explore Kivy API to develop user interfaces and control multi-touch events
  • Step-by-step recipes that provide deeper understanding of the Kivy 1.9.0 framework
  • Build and use your own events, widgets and gestures using features and tools in Kivy

Who This Book Is For

This book is intended for developers who want to use features of the Kivy framework and develop multi-touch applications. Prior experience with Kivy is not required, although familiarity with Python is expected.

What You Will Learn

  • Access widgets defined inside Kv language in your Python code
  • Handle Kivy events to control widgets, touches, the mouse, the keyboard, and animations
  • Recognize touch shapes and detecting multi-tapping
  • Create custom events and declare properties
  • Organizing your layouts while working with the ActionBar
  • Store and retrieve the coordinate space context
  • Create your own shader and render in a framebuffer
  • Leverage Factory objects, multi-touch in iOS and multi-touch in Android

In Detail

Kivy is an open-source Python library for rapid development of applications that make use of innovative user interfaces, such as multi-touch apps. It is a promising Python framework to develop UI and UX apps in a cross-platform environment, under the Python philosophy.

Kivy Cookbook is a practical book that will guide you through the Kivy framework to develop apps and get your apps ready for distribution in App Store and Android devices.

You will start off with installing Kivy and building your interfaces. You will learn how to work the accelerometer and create custom events. Then, you will understand how to use the basics, buttons, labels and text inputs and manipulate the widget tree. Next, you will be able to work with manipulating instructions, create an atlas and layouts. Moving on, you will learn packing for Windows and packing for iOS, and use TestDrive.

By the end of the book, you will have learnt in detail the relevant features and tools in Kivy and how to create portable packages to distribute your apps in the most used platforms.

Style and approach

This is an easy-to-follow practical guide packed with graspable recipes that cover important tasks to be performed while developing multi-touch applications with Kivy. All the code used in each recipe is explained in detail.

Table of contents

  1. Kivy Cookbook
    1. Table of Contents
    2. Kivy Cookbook
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why Subscribe?
        2. Free Access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Sections
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      5. Conventions
      6. Reader feedback
      7. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    8. 1. Kivy and the Kv Language
      1. Introduction
      2. Installing Kivy
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
          1. Mac OS X
          2. Microsoft Windows
        5. See also
      3. Building your interfaces
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      4. Declaring properties within a class
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      5. Relating Python code and the Kv language
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      6. Referencing widgets
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      7. Accessing widgets defined inside the Kv language in your Python code
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      8. Reusing styles in multiple widgets
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      9. Designing with the Kv language
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      10. Running your code
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
          1. Mac OS X
          2. Microsoft Windows
        5. See also
      11. Using Kivy garden
        1. Getting ready
        2. How to do it…
        3. There's more…
          1. Packing
    9. 2. Input, Motion, and Touch
      1. Introduction
      2. Using the mouse
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      3. Evolving to the touchscreen
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      4. Working with the accelerometer
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      5. Using the gyroscope
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      6. The differences between the touch and motion events
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      7. Recognizing touch shapes
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      8. Detecting multitapping
        1. Getting ready
        2. How to do it…
        3. How it works…
      9. Grabbing touch events
        1. Getting ready
        2. How to do it…
        3. How it works…
      10. Recording gestures
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
    10. 3. Events
      1. Introduction
      2. Scheduling a one-time event
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      3. Scheduling a repetitive event
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      4. Triggering events
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      5. Defining widget events
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      6. Creating custom events
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      7. Attaching callbacks
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      8. Declaring a property
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      9. Compounding properties
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
    11. 4. Widgets
      1. Introduction
      2. Using the basics: buttons, labels, and text inputs
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      3. Manipulating the widget tree
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      4. Traversing the tree
        1. Getting ready
        2. How to do it…
        3. How it works…
      5. Using swappable widgets
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      6. Organizing with layouts
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      7. Using FloatLayout
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      8. Using BoxLayout
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      9. Using GridLayout
        1. How to do it…
        2. How it works…
        3. There's more…
      10. Using StackLayout
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      11. Using RelativeLayout
        1. Getting ready
        2. How to do it…
        3. How it works…
      12. Using AnchorLayout
        1. How to do it…
        2. How it works…
      13. Working with ActionBar
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
    12. 5. Graphics – Canvas and Instructions
      1. Introduction
      2. Separating with the screen manager
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      3. Using drawing instructions
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      4. Using context instructions
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      5. Working with manipulating instructions
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      6. Rotating, translating, and scaling the canvas
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      7. Modifying with multitouching
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      8. Storing and retrieving the coordinate space context
        1. Getting ready
        2. How to do it…
      9. Introducing animations
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
    13. 6. Advanced Graphics – Shaders and Rendering
      1. Introduction
      2. Using Carousel
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      3. Creating and using Atlas
        1. Getting ready
        2. How to do it…
        3. How it works…
      4. Creating layouts
        1. Getting ready
        2. How to do it…
        3. How it works…
      5. Editing shaders
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      6. Creating widgets
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      7. Creating your own shader
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      8. Rendering in a Framebuffer
        1. Getting ready
        2. How to do it…
        3. How it works…
      9. Optimizing graphics
        1. Getting ready
        2. How to do it…
        3. There's more…
        4. See also
    14. 7. The API in Detail
      1. Introduction
      2. Getting to know the API
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      3. Using the asynchronous data loader
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      4. Logging objects
        1. How to do it…
        2. How it works…
        3. There's more…
        4. See also
      5. Parsing
        1. How to do it…
        2. How it works…
        3. See also
      6. Applying utils
        1. How to do it…
        2. How it works…
        3. See also
      7. Leveraging the factory object
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      8. Working with audio
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      9. Working with video
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      10. Working with a camera
        1. Getting ready
        2. How to do it…
        3. There's more…
      11. Using spelling
        1. Getting ready
        2. How to do it…
        3. How it works…
      12. Adding effects
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      13. Advanced text manipulation
        1. How to do it…
        2. How it works…
        3. There's more…
        4. See also
    15. 8. Packaging our Apps for PC
      1. Introduction
      2. Packaging for Windows
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      3. Including multimedia for Windows
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      4. Running apps in Windows
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      5. Packaging for Mac OS
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      6. Including multimedia for Mac OS
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      7. Running apps in Mac OS
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      8. Packaging for Linux
        1. Getting ready
        2. How to do it…
      9. Including multimedia for Linux
        1. Getting ready
        2. How to do it…
      10. Running apps in Linux
        1. Getting ready
        2. How to do it…
        3. How it works…
    16. 9. Kivy for Mobile Devices
      1. Introduction
      2. Packaging for iOS
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      3. Resizing the screen into iOS
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      4. Leveraging mobile features in iOS
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      5. Preparing for the App Store
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      6. Packaging for Android
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      7. Resizing the screen into Android
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      8. Leveraging mobile features in Android
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
    17. Index

Product information

  • Title: Kivy Cookbook
  • Author(s): Hugo Solis
  • Release date: August 2015
  • Publisher(s): Packt Publishing
  • ISBN: 9781783987382