phoenix_title wx.lib.colourchooser.canvas.Canvas

A canvas class for arbitrary drawing.

The Canvas class implements a window that allows for drawing arbitrary graphics. It implements a double buffer scheme and blits the off-screen buffer to the window during paint calls by the windowing system for speed.

Some other methods for determining the canvas colour and size are also provided.


class_hierarchy Class Hierarchy

Inheritance diagram for class Canvas:

super_classes Known Superclasses

wx.Window


method_summary Methods Summary

__init__

Creates a canvas instance and initializes the off-screen

Blit

Performs the blit of the buffer contents on-screen.

DrawBuffer

Actual drawing function for drawing into the off-screen

GetBoundingRect

Returns a tuple that contains the coordinates of the

MakeNewBuffer

onPaint

Renders the off-screen buffer on-screen.

onSize

Perform actual redraw to off-screen buffer only when the

ReDraw

Explicitly tells the canvas to redraw it’s contents.

Refresh

Re-draws the buffer contents on-screen.


api Class API

class Canvas(wx.Window)

A canvas class for arbitrary drawing.

The Canvas class implements a window that allows for drawing arbitrary graphics. It implements a double buffer scheme and blits the off-screen buffer to the window during paint calls by the windowing system for speed.

Some other methods for determining the canvas colour and size are also provided.


Methods

__init__(self, parent, id, pos=wx.DefaultPosition, style=wx.SIMPLE_BORDER, forceClientSize=None)

Creates a canvas instance and initializes the off-screen buffer. Also sets the handler for rendering the canvas automatically via size and paint calls from the windowing system.



Blit(self, dc)

Performs the blit of the buffer contents on-screen.



DrawBuffer(self)

Actual drawing function for drawing into the off-screen buffer. To be overrideen in the implementing class. Do nothing by default.



GetBoundingRect(self)

Returns a tuple that contains the coordinates of the top-left and bottom-right corners of the canvas.



MakeNewBuffer(self)


onPaint(self, event)

Renders the off-screen buffer on-screen.



onSize(self, event)

Perform actual redraw to off-screen buffer only when the size of the canvas has changed. This saves a lot of computation since the same image can be re-used, provided the canvas size hasn’t changed.



ReDraw(self)

Explicitly tells the canvas to redraw it’s contents.



Refresh(self)

Re-draws the buffer contents on-screen.