Mobile devices have changed the way applications are. They have increased interaction types the user expects gestures, multi-touches, animations, and magic-pens. Moreover, compatibility has become a must-have if you want to avoid the barriers imposed by major Operative Systems. Kivy is an Open Source Python solution that covers these market needs with an easy to learn and rapid development approach. Kivy is growing fast and gaining attention as an alternative to the established developing platforms.
This book introduces you into the Kivy world, covering a large variety of important topics related to interactive application development. The components presented in this book were not only selected according to their usefulness for developing state-of-the- art applications, but also for serving as an example of broader Kivy functionalities. Following this approach, the book covers a big part of the Kivy library.
Instead of giving a detailed description of all the functions and properties, it provides you with examples to understand their use and how to integrate the two big projects that come with the book. The first one, the comic creator, exemplifies how to build a user interface, how to draw vector shapes in the screen, how to bind user interactions with pieces codes and other components related to improve the user experience. The second project, Invaders Revenge, is a very interactive game that introduces you to the use of animations, scheduling of tasks, keyboard events and multi-touch control.
Occasionally the book explains some technical but important Kivy concepts that are related to the order and strategies used to draw in the screen. These explanations give the readers some insights into the Kivy internals that will help them solve potential problems when they are developing their own projects. Even though they are not necessary for the comprehension of the main topics of this book, they will become important lessons when the readers are implementing their own applications.
The book keeps the readers attention by stating small problems and their solutions. The sections are short and straightforward, making the learning process constant. These short sections will also serve as a reference when they finish the book. However, serving as a reference doesn't prevent the text from achieving the main goal, which is teaching with bigger projects that connects the small topics. At the end of the book, the readers will feel comfortable to start their own project.
Chapter 1, GUI Basics Building an Interface ntroduces basic components and layouts of Kivy and how to integrate them through the Kivy Language
Chapter 2,Graphics The Canvas xplains the use of the canvas and how to draw vector figures on the screen
Chapter 3, Widget Events - Binding Actions eaches how to connect the interactions of the user through the interface with particular code inside the program
Chapter 4,Improving the User Experience introduces a collection of useful components to enrich the interaction of the user with the interface
Chapter 5, Invaders Revenge Multitouch ntroduces components and strategies to build highly interactive applications
This book requires a running installation of Kivy with all its requirements. The installation instructions can be found at http://kivy.org/docs/gettingstarted/installation.html.
The book aims at Python developers who want to create exciting and interesting UI/UX applications. They should be already familiarized with Python and a good understanding of some software engineering concepts, particularly inheritance, classes and instances. That said, the code is kept as simple as possible and it avoids the use of very specific Python nuances. No previous experience of Kivy is required though some knowledge of event handling, scheduling and user interface, in general, would boost your learning.
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text are shown as follows: "Missile
and Shot
inherits from the same class called Ammo, which also inherits from Image. There is also the Boom class that will create the effect of explosion when any Ammo is triggered."
A block of code is set as follows:
# File name: hello.py import kivy kivy.require('1.7.0') from kivy.app import App from kivy.uix.button import Label class HelloApp(App): def build(self): return Label(text='Hello World!') if __name__=="__main__": HelloApp().run()
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Consider App as an empty window as shown in the following screenshot (Hello World! output)".
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <[email protected]>
, and mention the book title via the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
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.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]>
with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
You can contact us at <[email protected]>
if you are having a problem with any aspect of the book, and we will do our best to address it.