Kivy: Interactive Applications in Python
Table of Contents
Kivy: Interactive Applications in Python
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. GUI Basics – Building an Interface
Hello World!
Basic widgets – labels and buttons
Layouts
Embedding layouts
Our Project – comic creator
Summary
2. Graphics – The Canvas
Basic shapes
Images, colors, and backgrounds
Rotating, translating, and scaling
Comic creator – PushMatrix and PopMatrix
Summary
3. Widget Events – Binding Actions
Attributes, id and root
Basic widget events – dragging the stickman
Localizing coordinates – adding stickmen
Binding and unbinding events – sizing limbs and heads
Binding events in the Kivy language
Creating your own events – the magical properties
Kivy and properties
Summary
4. Improving the User Experience
Screen manager – selecting colors for the figures
Color Control on the canvas – coloring figures
StencilView – limiting the drawing space
Scatter – multitouching to drag, rotate, and scale
Recording gestures – line, circles, and cross
Simple gestures – drawing with the finger
Summary
5. Invaders Revenge – An Interactive Multitouch Game
Invaders Revenge – an animated multitouch game
Atlas – efficient management of images
Boom – simple sound effects
Ammo – simple animation
Invader – transitions for animations
Dock – automatic binding in the Kivy language
Fleet – infinite concatenation of animations
Scheduling events with the Clock
Shooter – multitouch control
Invasion – moving the shooter with the keyboard
Combining animations with '+' and '&'
Summary
Index
Kivy: Interactive Applications in Python
Copyright © 2013 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: September 2013
Production Reference: 1190913
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78328-159-6
www.packtpub.com
Author
Roberto Ulloa
Reviewers
Anai Arroyo B.
Andrés Vargas González
Javier de la Rosa
Hugo Solis
Acquisition Editor
James Jones
Commissioning Editor
Sruthi Kutty
Technical Editors
Ruchita Bhansali
Gauri Dasgupta
Monica John
Project Coordinator
Michelle Quadros
Proofreader
Amy Johnson
Indexer
Monica Ajmera Mehta
Graphics
Ronak Dhruv
Production Coordinator
Nilesh R. Mohite
Cover Work
Nilesh R. Mohite
Roberto Ulloa has a diverse academic record in multiple disciplines within the field of Computer Science. He obtained an MSc from the University of Costa Rica and also taught programming and computer networking there. He then spent two years researching about cultural complexity at PhD level at the CulturePlex Lab of the University of Western Ontario.
He loves travelling and enjoys an itinerant life, living among different cultures and environments. He loves nature and has spent many months volunteering in Central and South America.
He currently lives in Kuala Lumpur, earning a living as a web developer in Python/Django and PHP/Wordpress. He constantly worries that the Internet has already become aware of itself and we are not able to communicate with it because of the improbability of it being able to speak Spanish or any of the 6,000 odd human languages that exist in this world.
I would like to thank Su, for not hesitating one second in encouraging and trusting my ability to write this book; for believing in me and motivating me with endless cups of coffee.
Javier de la Rosa, with whom I worked on my first Kivy project—the one that gave birth to the blog post that caught the attention of my publishers.
My technical reviewers, Anaí Arroyo, Javier de la Rosa, Hugo Solís and Andrés Vargas for their time and corrections.
My supervisor, Gabriela Barrantes, who has been a constant source of support and inspiration throughout my academic life.
My family and friends, for whom this book will be a surprise, and who've paid with the time that I didn't have to share with them.
The editorial personnel, for their patience in answering my questions.
Celina, for risking her Android to test my codes for the first time; for her constant motivation, support, and criticism even though I disagree that my Space Invaders look like bunnies and, if so, I still think they are terrifying space bunnies.
Anaí Arroyo is a PMI certified Project Manager who loves software development and is passionate about how technology can be used to improve the quality of people's life and volunteering as a way to contribute to make a positive difference.
Over the last years, she has worked in the Education field, collaborating in the design and development of Learning Management and Student Information Management systems.
Andrés Vargas González is currently pursuing a Master of Science in Computer Science through a Fulbright Fellowship at University of Central Florida (UCF). He received a Bachelor's degree in the same f...