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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access