O'Reilly logo

Kivy: Interactive Applications in Python by Roberto Ulloa

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Localizing coordinates – adding stickmen

In the last section, we used the to_parent() method (line 66) to translate the coordinates relative to the DrawingSpace to its parent.

Note

Please note, that we were inside DraggableWidget and the coordinates we received were relative to the parent (DrawingSpace).

These coordinates are convenient for DraggableWidget because we position it in the parent's coordinates. It allows us to use the coordinates in the parent's collide_point. This is no longer convenient when we want to check the coordinates on the parent's parent space or when we need to draw something directly on the canvas of a Widget.

Before studying more examples, let's summarize the theory.You learned that RelativeLayout is very useful because ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required