Kivy: Interactive Applications in Python Create cross-platform UI/UX applications and games in Python Roberto Ulloa BIRMINGHAM - MUMBAI 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 Cover Image by Aniket Sawant ([email protected]) Credits Author Project Coordinator Roberto Ulloa Michelle Quadros Reviewers Proofreader Anai Arroyo B. Amy Johnson Andrés Vargas González Javier de la Rosa Indexer Monica Ajmera Mehta Hugo Solis Graphics Acquisition Editor Ronak Dhruv James Jones Production Coordinator Commissioning Editor Nilesh R. Mohite Sruthi Kutty Cover Work Technical Editors Nilesh R. Mohite Ruchita Bhansali Gauri Dasgupta Monica John About the Author 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. Acknowledgments 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. About the Reviewers 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 field from Escuela Superior Politécnica del Litoral (ESPOL) in Ecuador. He is a member of the Interactive Systems and User Experience Lab at UCF. His current research is on machine learning techniques to reduce the time on gesture recognition in context. His previous works include enterprise multimedia distribution and exploring usability of multi-touch interfaces in Information Systems, which was tested on his DIY multi-touch surface. He is also interested in web applications development. He implemented some e-commerce solutions as well as Facebook applications in his home country and recently was working in the backend of an educational data resource system in Florida, USA. Besides his academic and professional interests, he enjoys hiking high elevations, learning from different cultures, biking by the city, and finally, playing and watching soccer. First and foremost, I would like to thank my four mothers for the values, love, and inspiration I got from them every moment of my life. I also wish to express my sincere gratitude to Shivani Wala for providing me an opportunity to be part of this great project. At the same time my special thanks to Michelle Quadros for keeping me updated with the deadlines and any doubt I had. Last but not least I wish to avail myself of this opportunity, express a sense of gratitude and love to my relatives, professors, and friends. Javier de la Rosa is a full-stack Python developer since 2005, when he first met the Django web framework. During his years in Yaco, one of the main FLOSS-based companies in Spain, he leaded the Research and Development Team, participating in both European and national projects. Late in 2009, he started to collaborate with The CulturePlex Lab for Cultural Networks research, at the Western Unviersity in Canada, in his sparse time. As a result, he left Yaco in 2010 and joined the laboratory to lead and supervise technical and software developments. Today, he is still in charge of the developers team as well as conducting his own research on Big Culture, where he mixes his background as a BA and MA in Computer Sciences, Logics and Artificial Intelligence by the University of Seville, and his recent acquired skills as a 3rd year PhD student in Hispanic Studies at Western University in Canada. Currently, he just started his 1st year as a PhD in Computer Sciences, focusing on Graph Databases and Query Languages. A regular collaborator of Open Source projects, he is the owner and main developer of qbe (http://versae.github.io/qbe/) and neo4j-rest-client (https://github.com/versae/neo4j-rest-client). In the academic field, he is author of several articles, as well as one of the writers of the book Programming Historian 2 (http://programminghistorian.org/). You can always contact him on Twitter (@versae) or GitHub under the nickname versae. Hugo Solis is an assistant professor in the Physics Department at University of Costa Rica. His current research interests are computational cosmology, complexity and the influence of hydrogen on material properties. He has wide experience with languages including C/C++ and Python for scientific programming and visualization. He is a member of the Free Software Foundation and he has contributed code to some free software projects. Currently, he is in charge of the IFT, a Costa Rican scientific non-profit organization for the multidisciplinary practice of physics. (http://iftucr.org) I'd like to thank Katty Sanchez, my beloved mother, for her support and vanguard thoughts. www.PacktPub.com Support files, eBooks, discount offers and more You might want to visit www.PacktPub.com for support files and downloads related to your book. Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks. TM http://PacktLib.PacktPub.com Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books. Why Subscribe? • Fully searchable across every book published by Packt • Copy and paste, print and bookmark content • On demand and accessible via web browser Free Access for Packt account holders If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.