Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Kivy ??? Interactive Applications and Games in Python second edition

You're reading from   Kivy ??? Interactive Applications and Games in Python second edition Create responsive cross-platform UI/UX applications and games in Python using the open source Kivy library

Arrow left icon
Product type Paperback
Published in Jun 2015
Publisher
ISBN-13 9781785286926
Length 206 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Roberto Ulloa Roberto Ulloa
Author Profile Icon Roberto Ulloa
Roberto Ulloa
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Kivy – Interactive Applications and Games in Python Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. GUI Basics – Building an Interface FREE CHAPTER 2. Graphics – the Canvas 3. Widget Events – Binding Actions 4. Improving the User Experience 5. Invaders Revenge – an Interactive Multi-touch Game 6. Kivy Player – a TED Video Streamer Index

Creating your own events – the magical properties


This section covers the use of the 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 such as 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 the text is modified.

Note

Once we define a Kivy property, Kivy internally creates an event associated with that property. The property event is referenced adding the prefix on_ to the name of the property. For example, the on_translation method (line 246) is associated with ListProperty in line 219 called translation.

All the properties work in the same way. For example, the state property that we used in the ToogleButton class is actually a property that creates the on_state event. We already used this event in line 206. We define the property and...

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
Visually different images