Preface

This book introduces Kivy, an exciting new graphical user interface library that finally allows Python to be used to code cross-platform applications on most traditional and mobile operating systems. I’m happy you’re here to study Kivy with me and hope that you’ll enjoy reading it as much as I have enjoyed writing it. I am confident that you will be happy with the two Apps you develop and deploy in this book and that it will lead you to develop many new applications of your own design. I look forward to seeing your Kivy Apps on the Android and iTunes market in the near future!

Who Should Read This Book

This book is primarily targeted to fairly new programmers who have read the Python tutorial, but haven’t done a lot of real-world coding. In addition to instructing you in Kivy, this book introduces you to the programming workflow. Each chapter builds on the previous chapter to help you create a fully functional mobile application. You will learn the steps you need to follow to design and implement your own apps.

It will also be applicable to programmers who have not worked with Python before but want to use Kivy for its amazing API, integrated multitouch support, or cross-platform deployment. You will probably want to review the Python tutorial to get a leg up on the language’s syntax before reading this book. You may be able to skim some sections of the text if you already understand the culture of coding.

Technology Used in This Book

The examples in this book all target Python 3. All but three of them also run seamlessly on Python 2.7. Those three examples have been highlighted in sidebars that include simple workarounds you can use to make the code run on both Python 2.7 and Python 3. Then, any future examples that use the same code will always use the version that works on both Pythons.

I encourage you to use Python 3 if possible, as it is a more enjoyable language to work with, provides nicer APIs, and is slowly being adopted by the entire Python community. That said, depending on what operating system you use, Python 2 may be easier to deploy and develop against at this time. You will have no trouble using Python 2.7 with the examples in this book if you prefer it.

This book was written entirely against Kivy 1.8, which is the first version of Kivy to support Python 3. The examples have been tested somewhat against Kivy 1.7, and it works with all the chapters except Chapter 6. Please use Kivy 1.8 or later if you can. The Kivy developers move very fast, and the newest version is always far better than the previous one in all dimensions: speed, stability, and features.

Conventions Used in This Book

The following typographical conventions are used in this book:

Italic
Indicates new terms, URLs, email addresses, filenames, and file extensions.
Constant width
Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords. Also used for commands and command-line options.
Constant width bold
Shows commands or other text that should be typed literally by the user.
Constant width italic
Shows text that should be replaced with user-supplied values or by values determined by context.

Tip

This element signifies a tip or suggestion.

Note

This element signifies a general note.

Warning

This element indicates a warning or caution.

Using Code Examples

Supplemental material (code examples, exercises, etc.) is available for download at https://github.com/oreillymedia/creating_apps_in_kivy.

This book is here to help you get your job done. In general, if example code is offered with this book, you may use it in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission.

We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “Creating Apps in Kivy by Dusty Phillips (O’Reilly). Copyright 2014 Dusty Phillips, 978-1-491-94667-1.”

If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at .

Safari® Books Online

Note

Safari Books Online is an on-demand digital library that delivers expert content in both book and video form from the world’s leading authors in technology and business.

Technology professionals, software developers, web designers, and business and creative professionals use Safari Books Online as their primary resource for research, problem solving, learning, and certification training.

Safari Books Online offers a range of product mixes and pricing programs for organizations, government agencies, and individuals. Subscribers have access to thousands of books, training videos, and prepublication manuscripts in one fully searchable database from publishers like O’Reilly Media, Prentice Hall Professional, Addison-Wesley Professional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Technology, and dozens more. For more information about Safari Books Online, please visit us online.

How to Contact Us

Please address comments and questions concerning this book to the publisher:

O’Reilly Media, Inc.
1005 Gravenstein Highway North
Sebastopol, CA 95472
800-998-9938 (in the United States or Canada)
707-829-0515 (international or local)
707-829-0104 (fax)

We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at http://oreil.ly/apps-kivy.

To comment or ask technical questions about this book, send email to .

For more information about our books, courses, conferences, and news, see our website at http://www.oreilly.com.

Find us on Facebook: http://facebook.com/oreilly

Follow us on Twitter: http://twitter.com/oreillymedia

Watch us on YouTube: http://www.youtube.com/oreillymedia

Content Updates

August 2014

Updates to this book include the addition of a new game app in Chapters 10, 11, and 12. These chapters cover advanced graphics, basic game physics, and game design.

Acknowledgments

My editor at O’Reilly, Meghan Blanchette, has been a dream to work with. I’ve read acknowledgments in many other books in which authors thanked their editors “first and foremost.” My experience with other editors has often made me wonder why. Meg’s support has been terrific throughout the process of writing this book.

Please heap gratitude on the entire Kivy development team. I’ve been doing GUI programming for years and have touched many toolkits in Python and other languages. Kivy is the first of the many user interface toolkits I have used that I truly enjoy. Designing a good UI API is extremely challenging (or someone would have got it right before now), and the Kivy developers deserve many, many accolades for their amazing work. Please tip them profusely using Gittip!

I want to especially thank Gabriel Pettier (tshirtman) not only for developing and maintaining Kivy, but also for his technical review of this book. He pointed out many flaws, omissions, and inconsistencies, which helped me refine the end product into what it is. Jennifer Pierce also tech-reviewed the book from a beginner’s perspective and highlighted the areas where I was confusing my readers.

Finally, I want to thank every person who has ever spoken publicly about dealing with mental illness. The wall of silence around all mental illnesses is doing society a huge disservice. Every time someone speaks about this topic, the mentally ill are perceived as somewhat more acceptable and contributing members of society. I’ve done many incredible things since dealing with a near-terminal form of my illness three years ago. Others have not been so fortunate. We need to talk so that brilliant minds can discover that treatment is available before they succumb to their illness, as Aaron Swartz and Ilya Zhitomirskiy did.

Get Creating Apps in Kivy now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.