June 2015
Intermediate to advanced
206 pages
4h 32m
English
In Chapter 3, Widget Events – Binding Actions, we avoided drawing outside of the drawing space by using simple mathematics and collide_points. It was far from perfect (for example, it fails in the group mode or when we resize it), and it was tedious and prone to programming mistakes.
That was sufficient for a first example, however, StencilView is the easier way to go here. StencilView limits the drawing area to the space occupied by itself. Anything drawn outside that area is hidden. First, let's modify the file drawingspace.py with the following header:
97. # File name: drawingspace.py 98. from kivy.uix.stencilview import StencilView 99. 100. class DrawingSpace(StencilView): 101. ...
The DrawingSpace instance ...
Read now
Unlock full access