Reader small image

You're reading from  Kivy: Interactive Applications in Python

Product typeBook
Published inSep 2013
Reading LevelIntermediate
PublisherPackt
ISBN-139781783281596
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Roberto Ulloa
Roberto Ulloa
author image
Roberto Ulloa

Roberto Ulloa has a diverse academic record in multiple disciplines within the field of computer science. Currently, he is working with artificial societies as part of his PhD thesis at the University of Western Ontario. He obtained an MSc degree from the University of Costa Rica and taught programming and computer networking there. He has earned a living as a web developer, working with Python/Django and PHP/Wordpress. He collaborates with various researchers while also working on his own projects, including his blog (http://robertour.com). He constantly worries that the Internet has already become aware of itself and that we are not able to communicate with it because of the improbability of it being able to speak any of the 6,000-plus odd human languages that exist on the planet.
Read more about Roberto Ulloa

Right arrow

Kivy and properties


Even though we have only touched on explanations of properties in the section, the truth is that we have been using them since the beginning of this chapter.Kivy's internals are full of properties. They are almost everywhere. For example, when we implemented DraggableWidget, we simply modified theroperty center_x and center_y (line 72) and the whole Widget was updated because there are properties involved in the use of center_x.

The last example in this chapter illustrates how powerful the Kivy properties are. Here is the code for statusbar.py:

270. # File name: statusbar.py
271. from kivy.uix.boxlayout import BoxLayout
272. from kivy.properties import NumericProperty, ObjectProperty
273. 
274. class StatusBar(BoxLayout):
275.     counter = NumericProperty(0)
276.     previous_counter = 0
277. 
278.     def on_counter(self, instance, value):
279.         if value == 0:
280.             self.msg_text = "Drawing space cleared"
281.         elif value - 1 == self.__class__...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Kivy: Interactive Applications in Python
Published in: Sep 2013Publisher: PacktISBN-13: 9781783281596

Author (1)

author image
Roberto Ulloa

Roberto Ulloa has a diverse academic record in multiple disciplines within the field of computer science. Currently, he is working with artificial societies as part of his PhD thesis at the University of Western Ontario. He obtained an MSc degree from the University of Costa Rica and taught programming and computer networking there. He has earned a living as a web developer, working with Python/Django and PHP/Wordpress. He collaborates with various researchers while also working on his own projects, including his blog (http://robertour.com). He constantly worries that the Internet has already become aware of itself and that we are not able to communicate with it because of the improbability of it being able to speak any of the 6,000-plus odd human languages that exist on the planet.
Read more about Roberto Ulloa