Quick search

Scissor Instructions

New in version 1.9.1.

Scissor instructions clip your drawing area into a rectangular region.

The area provided to clip is in screenspace pixels and must be provided as integer values not floats.

The following code will draw a circle on top of our widget while clipping the circle so it does not expand beyond the widget borders.

with self.canvas.after:
    #If our widget is inside another widget that modified the coordinates
    #spacing (such as ScrollView) we will want to convert to Window coords
    x,y = self.to_window(*self.pos)
    width, height = self.size
    #We must convert from the possible float values provided by kivy
    #widgets to an integer screenspace, in python3 round returns an int so
    #the int cast will be unnecessary.
    ScissorPush(x=int(round(x)), y=int(round(y)),
        width=int(round(width)), height=int(round(height)))
    Color(rgba=(1., 0., 0., .5))
    Ellipse(size=(width*2., height*2.),
class x, int y, int width, int height)

Bases: builtins.object

Rect class used internally by ScissorStack and ScissorPush to determine correct clipping area.

intersect(self, Rect other)


Pop the scissor stack. Call after ScissorPush, once you have completed the drawing you wish to be clipped.



to control the area and position of the scissoring region. Defaults to 0, 0, 100, 100

Scissor works by clipping all drawing outside of a rectangle starting at int x, int y position and having sides of int width by int height in Window space coordinates


Bases: builtins.object

Class used internally to keep track of the current state of glScissors regions. Do not instantiate, prefer to inspect the module’s scissor_stack.

push(self, element)