.. include:: headings.inc .. _DCClipper: ========================================================================================================================================== |phoenix_title| **DCClipper** ========================================================================================================================================== :ref:`DCClipper` is a helper class for setting a clipping region on a :ref:`DC` during its lifetime. An object of :ref:`DCClipper` class is typically created on the stack so that it is automatically destroyed when the object goes out of scope. A typical usage example: :: def MyFunction(dc): clip = wx.DCClipper(dc, rect) # ... drawing functions here are affected by clipping rect ... def OtherFunction(): dc = wx.DC() MyFunction(dc) # ... drawing functions here are not affected by clipping rect ... .. note:: Unlike other similar classes such as :ref:`DCFontChanger`, :ref:`DCClipper` currently doesn't restore the previously active clipping region when it is destroyed but simply resets clipping on the associated :ref:`DC`. This may be changed in the future wxWidgets versions but has to be taken into account explicitly in the current one. .. seealso:: :meth:`DC.SetClippingRegion` , :ref:`DCFontChanger`, :ref:`DCTextColourChanger`, :ref:`DCPenChanger`, :ref:`DCBrushChanger` | |class_hierarchy| Inheritance Diagram ===================================== Inheritance diagram for class **DCClipper** .. raw:: html

Inheritance diagram of DCClipper

| |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~DCClipper.__init__` Sets the clipping region to the specified region/coordinates. :meth:`~DCClipper.__enter__` :meth:`~DCClipper.__exit__` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: DCClipper(object) DCClipper is a helper class for setting a clipping region on a DC during its lifetime. **Possible constructors**:: DCClipper(dc, region) DCClipper(dc, rect) DCClipper(dc, x, y, w, h) .. method:: __init__(self, *args, **kw) Sets the clipping region to the specified region/coordinates. The clipping region is automatically unset when this object is destroyed. |overload| **Overloaded Implementations**: **~~~** **__init__** `(self, dc, region)` :param `dc`: :type `dc`: DC :param `region`: :type `region`: Region **~~~** **__init__** `(self, dc, rect)` :param `dc`: :type `dc`: DC :param `rect`: :type `rect`: Rect **~~~** **__init__** `(self, dc, x, y, w, h)` :param `dc`: :type `dc`: DC :param `x`: :type `x`: int :param `y`: :type `y`: int :param `w`: :type `w`: int :param `h`: :type `h`: int **~~~** .. method:: __enter__(self) .. method:: __exit__(self, exc_type, exc_val, exc_tb)