Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Kivy: Interactive Applications in Python

You're reading from  Kivy: Interactive Applications in Python

Product type Book
Published in Sep 2013
Publisher Packt
ISBN-13 9781783281596
Pages 138 pages
Edition 1st Edition
Languages
Author (1):
Roberto Ulloa Roberto Ulloa
Profile icon Roberto Ulloa

Table of Contents (13) Chapters

Kivy: Interactive Applications in Python
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
1. GUI Basics – Building an Interface 2. Graphics – The Canvas 3. Widget Events – Binding Actions 4. Improving the User Experience 5. Invaders Revenge – An Interactive Multitouch Game Index

Chapter 1. GUI Basics – Building an Interface

Kivy emerges as a successor of PyMT (a library for multitouch applications) with a simple but ambitious goal in mind — same code for every commonplace platform: Linux / Windows / Mac OS X / Macosx / Android / iOS (Mathieu Virbel, http://txzone.net/2011/01/kivy-next-pymt-on-android-step-1-done/). This support is being extended to Raspberry Pi thanks to a founding campaign started by Mathieu Virbel, the creator of Kivy. Kivy was introduced in the EuroPython 2011, as a Python framework designed for creating natural user interfaces.

So, let's start creating user interfaces using one of its fun and powerful components, the Kivy language (.kv). The Kivy language helps us to separate the logic from the presentation. This is a fundamental engineering concept that helps to keep an easy and intuitive code. Nonetheless, it is possible to build a Kivy application using pure Python and Kivy as a library. We will also learn those concepts in later chapters because they allow us to modify interfaces dynamically.

This chapter covers all the basics for building a graphical user interface (GUI) in Kivy. Afterwards, you will be able to build practically any GUI you have in your mind, and even make them responsive to the size of window! The following is a list of all the skills that you're about to learn:

  • Launching a Kivy application

  • The Kivy language

  • Creating and using widgets (GUI components)

  • Basic properties and variables of the widgets

  • Fixed, proportional, absolute, and relative coordinates

  • Organizing GUIs through layouts

  • Tips for achieving responsive GUIs

Apart from Python, this chapter requires some knowledge about Object-Oriented Programming (http://en.wikipedia.org/wiki/Object-oriented_programming) concepts. In particular, inheritance (http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming)) and the difference between instances (http://en.wikipedia.org/wiki/Instance_(computer_science)) and classes (http://en.wikipedia.org/wiki/Class_(computer_science)) will be assumed. Before starting, you will need to install Kivy (The instructions can be found in http://kivy.org/docs/installation/installation.html). The book examples were tested on Kivy 1.7.0 but a more recent version should work as well.

At the end of this chapter, we will be able to build a GUI starting from a pencil and paper sketch. We will introduce the main project of the book — the Comic Creator, and implement the main structure of the GUI.

You have been reading a chapter from
Kivy: Interactive Applications in Python
Published in: Sep 2013 Publisher: Packt ISBN-13: 9781783281596
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}