Scatter – multitouching to drag, rotate, and scale
In the previous chapter you learned how to use events to drag widgets. You learned how to use the on_touch_up
, on_touch_move
and on_touch_down
events. However, the Scatter
class already provides that functionality and also lets us scale and rotate using two fingers. All the functionality is included inside the Scatter
class, however, we need to apply a few changes to keep our project consistent. In particular, we still want our group mode to work, so that translating, scaling, and rotating can be happening at the same time. Let us implement the changes in four big steps in the comicwidgets.py
file:
Substitute in the
DraggableWidget
base class. Let's useScatter
instead ofRelativeLayout
(line 122 and 125):121. # File name: comicwidgets.py 122. from kivy.uix.scatter import Scatter 123. from kivy.graphics import Line 124. 125. class DraggableWidget(Scatter):
Note
Both,
Scatter
andRelativeLayout
use relative coordinates.Make sure that the
on_touch_down...