Making tiles
This part of the chapter is devoted to building the Tile
widget. Tiles are more dynamic in nature than, for example, the Board
widget that we've seen earlier. To account for this, we are going to create a number of Kivy properties on the Tile
class so that any visible change to tile automatically leads to redrawing it.
Kivy properties differ from regular Python ones: a property in Python is basically just a variable bound to an instance of class, possibly coupled with getter and setter functions. In Kivy, properties have an additional feature: they emit events when changed and as such you can observe interesting properties and adjust other related variables accordingly, or perhaps repaint the screen.
Most of this work happens under ...
Get Kivy Blueprints now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.