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

Creating your own events – the magical properties


This section covers the use of Kivy properties. A Kivy property triggers an event every time we modify it. There are different types of properties, from the simple NumericProperty or StringProperty to much more complex versions like ListProperty, DictProperty, or ObjectProperty. For example, if we define a StringProperty, called text, then an on_text event is going to be triggered each time text is modified.

Note

The on_translation method (line 243) is associated with the ListProperty in line 216 called translation. Once we define a Kivy property, Kivy internally creates an event associated with that property. The property name is generated adding the prefi x on_ to the name of the property.

All the properties work in the same way. For example, the state property of ToogleButton is actually a property which creates the on_state event. We alreadsed this event in line 203. We define the property and Kivy creates the event for us.

Note

In the context...

lock icon The rest of the chapter is locked
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}