Rotating, translating, and scaling the coordinate space
Rotate
, Translate
, and Scale
are context instructions that are applied to the vertex instructions, which are displayed in the coordinate space. They could bring unexpected results if we forget that the coordinate space is shared among all widgets, and it occupies the size of the window (actually bigger than that because there is no restriction on the coordinates and we can draw outside the window). First, we are going to understand the behavior of this instruction in this section and, in the next section, we can analyze the problems they bring in a deeper way, and learn techniques to make things easier.
Let's start with the new drawing.kv
code:
114. # File name: drawing.kv (Rotate, Translate and Scale) 115. <DrawingSpace>: 116. pos_hint: {'x':.5, 'y':.5} 117. canvas: 118. Rectangle: 119. source: 'kivy.png' 120. Rotate: 121. angle: 90 122. axis...