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.
wx.lib.colourchooser.pycolourslider.PyColourSlider
, wx.lib.colourchooser.pypalette.PyPalette
Creates a canvas instance and initializes the off-screen |
|
Performs the blit of the buffer contents on-screen. |
|
Actual drawing function for drawing into the off-screen |
|
Returns a tuple that contains the coordinates of the |
|
Renders the off-screen buffer on-screen. |
|
Perform actual redraw to off-screen buffer only when the |
|
Explicitly tells the canvas to redraw it’s contents. |
|
Re-draws the buffer contents on-screen. |
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.
__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.