O'Reilly logo

WxPython Application Development Cookbook by Cody Precord

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Drawing gradients with GraphicsContext

GraphicsContext is another drawing utility class, similar to a DeviceContext, which provides some higher-level or advanced functionality for drawing on screen. The GraphicsContext is a new feature that was added back in wxPython 2.8, which can be used to access some of the platform's higher-level drawing functionality-supporting features, such as antialiasing, a floating point precision coordinate system, alpha blending, gradient brushes, and a handful of other advanced methods. In this recipe, we will make use of some of these features, most notably the gradient brush, to draw a custom control that uses gradient shading to give more depth to the control's appearance.

How to do it…

Here are the steps you need ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required