You are previewing Kivy – Interactive Applications and Games in Python - Second Edition.
O'Reilly logo
Kivy – Interactive Applications and Games in Python - Second Edition

Book Description

Create responsive cross-platform UI/UX applications and games in Python using the open source Kivy library

In Detail

Kivy – Interactive Applications and Games in Python Second Edition, will equip you with all the necessary knowledge to create interactive, responsive, and cross-platform applications and games.

This book introduces the Kivy language and the necessary components so you can implement a graphical user interface (GUI) and learn techniques to handle events, detect gestures, and control multi-touch actions. You will learn strategies to animate your applications, and obtain interactive, professional-looking, and responsive results. You will be applying this knowledge throughout the book by developing three applications and tackling their diverse programming challenges.

What You Will Learn

  • Build responsive user interfaces (UIs) using the Kivy language and the Kivy widgets

  • Master the use of the Kivy canvas to display graphics on screen

  • Keep the UI updated on user input and screen size with Kivy properties

  • Bind and unbind Kivy events to control widgets, touches, the mouse, the keyboard, and animations

  • Scale, rotate, and translate widgets using finger gestures

  • Create and use your own gestures, and control multiple touches on the screen

  • Enhance your widgets with behaviors, animations, and transitions

  • Debug your application with the Kivy inspector

  • Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

    Table of Contents

    1. Kivy – Interactive Applications and Games in Python Second Edition
      1. Table of Contents
      2. Kivy – Interactive Applications and Games in Python Second Edition
      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. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. GUI Basics – Building an Interface
        1. Basic interface – Hello World!
        2. Basic widgets – labels and buttons
        3. Layouts
        4. Embedding layouts
        5. PageLayout – swiping pages
        6. Our project – Comic Creator
        7. Summary
      9. 2. Graphics – the Canvas
        1. Understanding the canvas
        2. Drawing basic shapes
        3. Adding images, colors, and backgrounds
        4. Structuring graphic instructions
        5. Rotating, translating, and scaling the coordinate space
        6. Comic Creator: PushMatrix and PopMatrix
        7. Summary
      10. 3. Widget Events – Binding Actions
        1. Attributes, ID, and root
        2. Basic widget events – dragging the stickman
        3. Localizing coordinates – adding stickmen
        4. Binding and unbinding events – sizing limbs and heads
        5. Binding events in the Kivy language
        6. Creating your own events – the magical properties
        7. Kivy and its properties
        8. Summary
      11. 4. Improving the User Experience
        1. ScreenManager – selecting colors for the figures
        2. Color control on the canvas – coloring figures
        3. StencilView – limiting the drawing space
        4. Scatter – multi-touching to drag, rotate, and scale
        5. Recording gestures – line, circle, and cross
        6. Recognizing gestures – drawing with the finger
        7. Behaviors – enhancing widget's functionality
        8. Style – decorating the interface
        9. Factory – replacing a vertex instruction
        10. Summary
      12. 5. Invaders Revenge – an Interactive Multi-touch Game
        1. Invaders Revenge – an animated multi-touch game
        2. Atlas – An efficient management of images
        3. Boom – simple sound effects
        4. Ammo – simple animation
        5. Invader – transitions for animations
        6. Dock – automatic binding in the Kivy language
        7. Fleet – infinite concatenation of animations
        8. Scheduling events with the clock
        9. Shooter – multi-touch control
        10. Invasion – moving the shooter with the keyboard
        11. Combining animations with '+' and '&'
        12. Summary
      13. 6. Kivy Player – a TED Video Streamer
        1. Video – play, pause, and stop
        2. AsyncImage – creating a cover for the video
        3. Subtitles – tracking the video progression
        4. Control bar – adding buttons to control the video
        5. Slider – including a progression bar
        6. Animation – hiding a widget
        7. Kivy inspector – debugging interfaces
        8. ActionBar – a responsive bar
        9. LoadDialog – displaying a directory of files
        10. ScrollView – displaying a list of videos
        11. Search – query the TED Developer API
        12. Summary
      14. Index