How to apply Canvas Color to Widgets

How to apply Canvas Color to Widgets


Here in this video we will see how we can apply Canvas instructions to our Child Widgets. Also, we will see how canvas.before, canvas and canvas.after instructions effect the UI representation of the Widgets.

Test Environment

Fedora 31
Kivy 1.11.1

What is Kivy Canvas

  • Every Kivy widget contains a canvas object
  • Canvas object contains all the drwaing instructions that will render the graphical representation of the object
  • There are two types of instructions that we can add to Canvas instances (ie. base classes VertexInstructions and ContextInstructions)
  • Basic geometric shapes can be drawn using the vertex instructions (ie. straight and curve lines, ellipse, polygons)
  • Coloring, Rotating, Translating and Scaling the coordinate space is done using context instructions
  • Kivy provides three canvas instances canvas.before, canvas, canvas.after

Here is the YouTube video to demonstrate on applying Canvas Colour for Widgets.

Hope you learning something in this video. Thank you for watching.