Connecting the dots

Our app already has a clear screen function but still draws just circles. Let's change it so that we can draw lines instead.

To follow continuous touch events (click-and-drag), we'll need to add a new event listener, on_touch_move. Every time the callback is invoked, it receives the latest point where the event occurred.

If we only had a single line going at every moment (like typically done on a desktop, since there is only one mouse pointer anyway), we could save the line we're currently drawing in self.current_line. But since we're aiming at multitouch support from the very beginning, we'll take another approach and store every line being drawn in the corresponding touch variable itself.

This works because for every continuous ...

Get Kivy Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.