Attributes, ID, and root
In
Chapter 1, GUI Basics – Building an Interface, we distinguished between four main components for our Comic Creator: tool box, drawing space, general options, and status bar. In this chapter, we will make these components interact with each other and, therefore, we need to add some attributes to the classes of the project we created in the previous chapters. These attributes will reference different parts of the interface so that they can communicate. For example, the ToolBox
class needs to have a reference to the DrawingSpace
instance, so the ToolButton
instances can draw their respective figures inside it. The following diagram shows all the relationships that are created in the comiccreator.kv
file:
We also learned in Chapter 1, GUI Basics – Building an Interface, that ID lets us reference other widgets in the Kivy language.
Note
The IDs are only meant to be used within the Kivy language. Therefore, we need...