Releases: P403n1x87/blighty
v2.1.2
v2.1.1
v2.1.0
v2.0.0 (bronzino)
What's New
Version 2 brings considerable performance upgrades and comes with an official
documentation hosted on ReadTheDocs.io.
Brushes have been extended to GTK canvases, thus extending compatibility and
portability even further.
v1.1.0
What's New
This release introduces brushes. Import the brush
decorator from blighty and use it to decorate methods that you want to rebind to the context object. This feature is similar to the draw methods of release 1.0.0, except they can have any name, as long as it doesn't clash with any methods or attributes from cairo.Context
.
v1.0.0 (apelles)
What's New
Methods of subclasses of the X11 Canvas
class that start with the draw_
prefix will be re-bound to the cairo context passed to the on_draw
callback method. For example,
class DrawMethodsCanvas(x11.Canvas):
def on_button_pressed(self, button, state, x, y):
if button == 1:
self.destroy()
def draw_rect(ctx, width, height):
ctx.set_source_rgb(*[r() for _ in range(3)])
ctx.rectangle(0, 0, width, height)
ctx.fill()
def on_draw(self, ctx):
for i in range(4):
ctx.draw_rect(self.width >> i, self.height >> i)
Whilst the method draw_rect
is defined inside the DrawMethodsCanvas
class, inside the on_draw
method it can be accessible as a method of ctx
(which is now an instance of ExtendedContext
, a wrapper around cairo.Context
).