Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Kivy Blueprints
  • Toc
  • feedback
Kivy Blueprints

Kivy Blueprints

By : Vasilkov
3.7 (10)
close
Kivy Blueprints

Kivy Blueprints

3.7 (10)
By: Vasilkov

Overview of this book

This book is intended for programmers who are comfortable with the Python language and who want to build desktop and mobile applications with rich GUI in Python with minimal hassle. Knowledge of Kivy is not strictly required—every aspect of the framework is described when it's first used.
Table of Contents (12 chapters)
close
10
A. The Python Ecosystem
11
Index

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 touch from start to end, all callbacks receive the same touch object. There is also a touch.ud property of the type dict (where ud is short for user data), which is specifically tailored to keep touch-specific attributes...

bookmark search playlist download font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete