.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2020 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc

.. currentmodule:: wx.lib.colourchooser.canvas

.. highlight:: python



.. _wx.lib.colourchooser.canvas.Canvas:

==========================================================================================================================================
|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
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>Canvas</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.lib.colourchooser.canvas.Canvas_inheritance.png" alt="Inheritance diagram of Canvas" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.lib.colourchooser.canvas.Canvas.html" title="wx.lib.colourchooser.canvas.Canvas" alt="" coords="5,315,263,344"/> <area shape="rect" id="node2" href="wx.Window.html" title="wx.Window" alt="" coords="85,237,183,267"/> <area shape="rect" id="node3" href="wx.WindowBase.html" title="wx.WindowBase" alt="" coords="69,160,199,189"/> <area shape="rect" id="node4" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="75,83,193,112"/> <area shape="rect" id="node5" href="wx.Object.html" title="wx.Object" alt="" coords="31,5,117,35"/> <area shape="rect" id="node6" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="142,5,249,35"/> </map> 
   </p>
   </div>

|


|sub_classes| Known Subclasses
==============================

:class:`wx.lib.colourchooser.pycolourslider.PyColourSlider`, :class:`wx.lib.colourchooser.pypalette.PyPalette`

|


|super_classes| Known Superclasses
==================================

:class:`wx.Window`

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.lib.colourchooser.canvas.Canvas.__init__`                             Creates a canvas instance and initializes the off-screen
:meth:`~wx.lib.colourchooser.canvas.Canvas.Blit`                                 Performs the blit of the buffer contents on-screen.
:meth:`~wx.lib.colourchooser.canvas.Canvas.DrawBuffer`                           Actual drawing function for drawing into the off-screen
:meth:`~wx.lib.colourchooser.canvas.Canvas.GetBoundingRect`                      Returns a tuple that contains the co-ordinates of the
:meth:`~wx.lib.colourchooser.canvas.Canvas.MakeNewBuffer`                        
:meth:`~wx.lib.colourchooser.canvas.Canvas.onPaint`                              Renders the off-screen buffer on-screen.
:meth:`~wx.lib.colourchooser.canvas.Canvas.onSize`                               Perform actual redraw to off-screen buffer only when the
:meth:`~wx.lib.colourchooser.canvas.Canvas.ReDraw`                               Explicitly tells the canvas to redraw it's contents.
:meth:`~wx.lib.colourchooser.canvas.Canvas.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.

   .. method:: __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.


   .. method:: Blit(self, dc)

      Performs the blit of the buffer contents on-screen.


   .. method:: DrawBuffer(self)

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


   .. method:: GetBoundingRect(self)

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


   .. method:: MakeNewBuffer(self)


   .. method:: onPaint(self, event)

      Renders the off-screen buffer on-screen.


   .. method:: 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.


   .. method:: ReDraw(self)

      Explicitly tells the canvas to redraw it's contents.


   .. method:: Refresh(self)

      Re-draws the buffer contents on-screen.


