Patterns

Learn about the Patterns in Pycairo.

We'll cover the following

Types of Patterns

Pattern is an abstract class that represents all of Pycairo’s fill methods. We cannot create a Pattern object (because the class is abstract), but we can create the following sub-classes:

  • SolidPattern creates a solid color fill. Setting this pattern has the same effect as using the set_source_rgb function.
  • LinearGradient creates a linear gradient fill.
  • RadialGradient creates a radial (circular) gradient fill. Here is an example of this:

Get hands-on with 1400+ tech skills courses.