Package wx :: Class DC

[frames | no frames]

## Type DC

    object --+
             |
        Object --+
                 |
                DC

Known Subclasses:
  `AutoBufferedPaintDC`, `GCDC`, `MetaFileDC`, `MirrorDC`, `PostScriptDC`, `PrinterDC`, `ScreenDC`, `WindowDC`

A wx.DC is a device context onto which graphics and text can be drawn. It is intended to represent a number of output devices in a generic way, so a window can have a device context associated with it, and a printer also has a device context. In this way, the same piece of code may write to a number of different devices, if the device context is used as a parameter.

Derived types of wxDC have documentation for specific features only, so refer to this section for most device context information.

The wx.DC class is abstract and can not be instantiated, you must use one of the derived classes instead. Which one will depend on the situation in which it is used.

Method Summary
| `__init__(self)`
| `__del__(self)`
| `__nonzero__(self)`
| `BeginDrawing(self)`
bool | ``Blit`(self, xdest, ydest, width, height, source, xsrc, ysrc, rop, useMask, xsrcMask, ysrcMask)` Copy from a source DC to this DC.
bool | ``BlitPointSize`(self, destPt, sz, source, srcPt, rop, useMask, srcPtMask)` Copy from a source DC to this DC.
| ``CalcBoundingBox`(self, x, y)` Adds the specified point to the bounding box which can be retrieved with `MinX`, `MaxX` and `MinY`, `MaxY` or `GetBoundingBox` functions.
| ``CalcBoundingBoxPoint`(self, point)` Adds the specified point to the bounding box which can be retrieved with `MinX`, `MaxX` and `MinY`, `MaxY` or `GetBoundingBox` functions.
bool | `CanDrawBitmap(self)`
bool | `CanGetTextExtent(self)`
| ``Clear`(self)` Clears the device context using the current background brush.
| ``ComputeScaleAndOrigin`(self)` Performs all necessary computations for given platform and context type after each change of scale and origin parameters.
| ``CrossHair`(self, x, y)` Displays a cross hair using the current pen.
| ``CrossHairPoint`(self, pt)` Displays a cross hair using the current pen.
| ``DestroyClippingRegion`(self)` Destroys the current clipping region so that none of the DC is clipped.
int | ``DeviceToLogicalX`(self, x)` Convert device X coordinate to logical coordinate, using the current mapping mode.
int | ``DeviceToLogicalXRel`(self, x)` Convert device X coordinate to relative logical coordinate, using the current mapping mode but ignoring the x axis orientation.
int | ``DeviceToLogicalY`(self, y)` Converts device Y coordinate to logical coordinate, using the current mapping mode.
int | ``DeviceToLogicalYRel`(self, y)` Convert device Y coordinate to relative logical coordinate, using the current mapping mode but ignoring the y axis orientation.
| ``DrawArc`(self, x1, y1, x2, y2, xc, yc)` Draws an arc of a circle, centred on the center point (xc, yc), from the first point to the second.
| ``DrawArcPoint`(self, pt1, pt2, center)` Draws an arc of a circle, centred on the center point (xc, yc), from the first point to the second.
| ``DrawBitmap`(self, bmp, x, y, useMask)` Draw a bitmap on the device context at the specified point.
| ``DrawBitmapPoint`(self, bmp, pt, useMask)` Draw a bitmap on the device context at the specified point.
| ``DrawCheckMark`(self, x, y, width, height)` Draws a check mark inside the given rectangle.
| ``DrawCheckMarkRect`(self, rect)` Draws a check mark inside the given rectangle.
| ``DrawCircle`(self, x, y, radius)` Draws a circle with the given center point and radius.
| ``DrawCirclePoint`(self, pt, radius)` Draws a circle with the given center point and radius.
| ``DrawEllipse`(self, x, y, width, height)` Draws an ellipse contained in the specified rectangle.
| ``DrawEllipseList`(self, ellipses, pens, brushes)` Draw a list of ellipses as quickly as possible.
| ``DrawEllipsePointSize`(self, pt, sz)` Draws an ellipse contained in the specified rectangle.
| ``DrawEllipseRect`(self, rect)` Draws an ellipse contained in the specified rectangle.
| ``DrawEllipticArc`(self, x, y, w, h, start, end)` Draws an arc of an ellipse, with the given rectangle defining the bounds of the ellipse.
| ``DrawEllipticArcPointSize`(self, pt, sz, start, end)` Draws an arc of an ellipse, with the given rectangle defining the bounds of the ellipse.
| ``DrawIcon`(self, icon, x, y)` Draw an icon on the display (does nothing if the device context is PostScript).
| ``DrawIconPoint`(self, icon, pt)` Draw an icon on the display (does nothing if the device context is PostScript).
Rect | ``DrawImageLabel`(self, text, image, rect, alignment, indexAccel)` Draw text and an image (which may be `wx.NullBitmap` to skip drawing it) within the specified rectangle, abiding by the alignment flags.
| ``DrawLabel`(self, text, rect, alignment, indexAccel)` Draw text within the specified rectangle, abiding by the alignment flags.
| ``DrawLine`(self, x1, y1, x2, y2)` Draws a line from the first point to the second.
| ``DrawLineList`(self, lines, pens)` Draw a list of lines as quickly as possible.
| ``DrawLinePoint`(self, pt1, pt2)` Draws a line from the first point to the second.
| ``DrawLines`(self, points, xoffset, yoffset)` Draws lines using a sequence of `wx.Point` objects, adding the optional offset coordinate.
| ``DrawPoint`(self, x, y)` Draws a point using the current pen.
| ``DrawPointList`(self, points, pens)` Draw a list of points as quickly as possible.
| ``DrawPointPoint`(self, pt)` Draws a point using the current pen.
| ``DrawPolygon`(self, points, xoffset, yoffset, fillStyle)` Draws a filled polygon using a sequence of `wx.Point` objects, adding the optional offset coordinate.
| ``DrawPolygonList`(self, polygons, pens, brushes)` Draw a list of polygons, each of which is a list of points.
| ``DrawRectangle`(self, x, y, width, height)` Draws a rectangle with the given top left corner, and with the given size.
| ``DrawRectangleList`(self, rectangles, pens, brushes)` Draw a list of rectangles as quickly as possible.
| ``DrawRectanglePointSize`(self, pt, sz)` Draws a rectangle with the given top left corner, and with the given size.
| ``DrawRectangleRect`(self, rect)` Draws a rectangle with the given top left corner, and with the given size.
| ``DrawRotatedText`(self, text, x, y, angle)` Draws the text rotated by angle degrees, if supported by the platform.
| ``DrawRotatedTextPoint`(self, text, pt, angle)` Draws the text rotated by angle degrees, if supported by the platform.
| ``DrawRoundedRectangle`(self, x, y, width, height, radius)` Draws a rectangle with the given top left corner, and with the given size.
| ``DrawRoundedRectanglePointSize`(self, pt, sz, radius)` Draws a rectangle with the given top left corner, and with the given size.
| ``DrawRoundedRectangleRect`(self, r, radius)` Draws a rectangle with the given top left corner, and with the given size.
| ``DrawSpline`(self, points)` Draws a spline between all given control points, (a list of `wx.Point` objects) using the current pen.
| ``DrawText`(self, text, x, y)` Draws a text string at the specified point, using the current text font, and the current text foreground and background colours.
| ``DrawTextList`(self, textList, coords, foregrounds, backgrounds)` Draw a list of strings using a list of coordinants for positioning each string.
| ``DrawTextPoint`(self, text, pt)` Draws a text string at the specified point, using the current text font, and the current text foreground and background colours.
| ``EndDoc`(self)` Ends a document (only relevant when outputting to a printer).
| `EndDrawing(self)`
| ``EndPage`(self)` Ends a document page (only relevant when outputting to a printer).
bool | ``FloodFill`(self, x, y, col, style)` Flood fills the device context starting from the given point, using the current brush colour, and using a style:
bool | ``FloodFillPoint`(self, pt, col, style)` Flood fills the device context starting from the given point, using the current brush colour, and using a style:
Bitmap | `GetAsBitmap(self, subrect)`
Brush | ``GetBackground`(self)` Gets the brush used for painting the background.
int | ``GetBackgroundMode`(self)` Returns the current background mode, either `wx.SOLID` or `wx.TRANSPARENT`.
(x1,y1, x2,y2) | ``GetBoundingBox`()` Returns the min and max points used in drawing commands so far.
Brush | ``GetBrush`(self)` Gets the current brush
int | ``GetCharHeight`(self)` Gets the character height of the currently set font.
int | ``GetCharWidth`(self)` Gets the average character width of the currently set font.
(x, y, width, height) | ``GetClippingBox`()` Gets the rectangle surrounding the current clipping region.
Rect | ``GetClippingRect`(self)` Gets the rectangle surrounding the current clipping region.
int | ``GetDepth`(self)` Returns the colour depth of the DC.
Point | `GetDeviceOrigin(self)`
(x,y) | `GetDeviceOriginTuple()`
Font | ``GetFont`(self)` Gets the current font
(width, height, descent, externalLeading) | ``GetFullTextExtent`(string, font)` Get the width, height, decent and leading of the text using the current or specified font.
int | ``GetLayoutDirection`(self)` Get the layout direction (LTR or RTL)_ for this dc.
int | ``GetLogicalFunction`(self)` Gets the current logical function (set by `SetLogicalFunction`).
Point | `GetLogicalOrigin(self)`
(x,y) | `GetLogicalOriginTuple()`
(xScale, yScale) | `GetLogicalScale()`
int | ``GetMapMode`(self)` Gets the current mapping mode for the device context
(width, height, lineHeight) | ``GetMultiLineTextExtent`(string, font)` Get the width, height, and line height of the text using the current or specified font.
| ``GetOptimization`(*args, **kwargs)` <function GetOptimization at 0xb7a83bc4> is deprecated
[widths] | ``GetPartialTextExtents`(self, text)` Returns a list of integers such that each value is the distance in pixels from the begining of text to the coresponding character of text.
Pen | ``GetPen`(self)` Gets the current pen
Colour | ``GetPixel`(self, x, y)` Gets the colour at the specified location on the DC.
Colour | `GetPixelPoint(self, pt)`
Size | ``GetPPI`(self)` Resolution in pixels per inch
Size | ``GetSize`(self)` This gets the horizontal and vertical resolution in device units.
Size | ``GetSizeMM`(self)` Get the DC size in milimeters.
(width, height) | ``GetSizeMMTuple`()` Get the DC size in milimeters.
(width, height) | ``GetSizeTuple`()` This gets the horizontal and vertical resolution in device units.
Colour | ``GetTextBackground`(self)` Gets the current text background colour
(width, height) | ``GetTextExtent`(string)` Get the width and height of the text using the current font.
Colour | ``GetTextForeground`(self)` Gets the current text foreground colour
(xScale, yScale) | ``GetUserScale`(self)` Gets the current user scale factor (set by `SetUserScale`).
| ``GradientFillConcentric`(self, rect, initialColour, destColour, circleCenter)` Fill the area specified by rect with a radial gradient, starting from initialColour in the center of the circle and fading to destColour on the outside of the circle.
| ``GradientFillLinear`(self, rect, initialColour, destColour, nDirection)` Fill the area specified by rect with a linear gradient, starting from initialColour and eventually fading to destColour.
bool | ``IsOk`(self)` Returns true if the DC is ok to use.
int | ``LogicalToDeviceX`(self, x)` Converts logical X coordinate to device coordinate, using the current mapping mode.
int | ``LogicalToDeviceXRel`(self, x)` Converts logical X coordinate to relative device coordinate, using the current mapping mode but ignoring the x axis orientation.
int | ``LogicalToDeviceY`(self, y)` Converts logical Y coordinate to device coordinate, using the current mapping mode.
int | ``LogicalToDeviceYRel`(self, y)` Converts logical Y coordinate to relative device coordinate, using the current mapping mode but ignoring the y axis orientation.
int | ``MaxX`(self)` Gets the maximum horizontal extent used in drawing commands so far.
int | ``MaxY`(self)` Gets the maximum vertical extent used in drawing commands so far.
int | ``MinX`(self)` Gets the minimum horizontal extent used in drawing commands so far.
int | ``MinY`(self)` Gets the minimum vertical extent used in drawing commands so far.
bool | ``Ok`(self)` Returns true if the DC is ok to use.
| ``ResetBoundingBox`(self)` Resets the bounding box: after a call to this function, the bounding box doesn't contain anything.
| ``SetAxisOrientation`(self, xLeftRight, yBottomUp)` Sets the x and y axis orientation (i.e., the direction from lowest to highest values on the axis).
| ``SetBackground`(self, brush)` Sets the current background brush for the DC.
| ``SetBackgroundMode`(self, mode)` mode may be one of `wx.SOLID` and `wx.TRANSPARENT`.
| ``SetBrush`(self, brush)` Sets the current brush for the DC.
| ``SetClippingRect`(self, rect)` Sets the clipping region for this device context to the intersection of the given region described by the parameters of this method and the previously set clipping region.
| ``SetClippingRegion`(self, x, y, width, height)` Sets the clipping region for this device context to the intersection of the given region described by the parameters of this method and the previously set clipping region.
| ``SetClippingRegionAsRegion`(self, region)` Sets the clipping region for this device context to the intersection of the given region described by the parameters of this method and the previously set clipping region.
| ``SetClippingRegionPointSize`(self, pt, sz)` Sets the clipping region for this device context to the intersection of the given region described by the parameters of this method and the previously set clipping region.
| `SetDeviceOrigin(self, x, y)`
| `SetDeviceOriginPoint(self, point)`
| ``SetFont`(self, font)` Sets the current font for the DC.
| ``SetLayoutDirection`(self, dir)` Change the layout direction for this dc.
| ``SetLogicalFunction`(self, function)` Sets the current logical function for the device context.
| `SetLogicalOrigin(self, x, y)`
| `SetLogicalOriginPoint(self, point)`
| `SetLogicalScale(self, x, y)`
| ``SetMapMode`(self, mode)` The mapping mode of the device context defines the unit of measurement used to convert logical units to device units.
| ``SetOptimization`(*args, **kwargs)` <function SetOptimization at 0xb7a83b8c> is deprecated
| ``SetPalette`(self, palette)` If this is a window DC or memory DC, assigns the given palette to the window or bitmap associated with the DC.
| ``SetPen`(self, pen)` Sets the current pen for the DC.
| ``SetTextBackground`(self, colour)` Sets the current text background colour for the DC.
| ``SetTextForeground`(self, colour)` Sets the current text foreground colour for the DC.
| ``SetUserScale`(self, x, y)` Sets the user scaling factor, useful for applications which require 'zooming'.
bool | ``StartDoc`(self, message)` Starts a document (only relevant when outputting to a printer).
| ``StartPage`(self)` Starts a document page (only relevant when outputting to a printer).

Property Summary
| `Background`: See `GetBackground` and `SetBackground`
| `BackgroundMode`: See `GetBackgroundMode` and `SetBackgroundMode`
| `BoundingBox`: See `GetBoundingBox`
| `Brush`: See `GetBrush` and `SetBrush`
| `CharHeight`: See `GetCharHeight`
| `CharWidth`: See `GetCharWidth`
| `ClippingBox`: See `GetClippingBox`
| `ClippingRect`: See `GetClippingRect` and `SetClippingRect`
| `Depth`: See `GetDepth`
| `DeviceOrigin`: See `GetDeviceOrigin` and `SetDeviceOrigin`
| `Font`: See `GetFont` and `SetFont`
| `FullTextExtent`: See `GetFullTextExtent`
| `LayoutDirection`
| `LogicalFunction`: See `GetLogicalFunction` and `SetLogicalFunction`
| `LogicalOrigin`: See `GetLogicalOrigin` and `SetLogicalOrigin`
| `LogicalScale`: See `GetLogicalScale` and `SetLogicalScale`
| `MapMode`: See `GetMapMode` and `SetMapMode`
| `MultiLineTextExtent`: See `GetMultiLineTextExtent`
| `Optimization`: See `GetOptimization` and `SetOptimization`
| `PartialTextExtents`: See `GetPartialTextExtents`
| `Pen`: See `GetPen` and `SetPen`
| `Pixel`: See `GetPixel`
| `PixelPoint`: See `GetPixelPoint`
| `PPI`: See `GetPPI`
| `Size`: See `GetSize`
| `SizeMM`: See `GetSizeMM`
| `TextBackground`: See `GetTextBackground` and `SetTextBackground`
| `TextExtent`: See `GetTextExtent`
| `TextForeground`: See `GetTextForeground` and `SetTextForeground`
| `thisown`: The membership flag
| `UserScale`: See `GetUserScale` and `SetUserScale`

Method Details

### Blit(self, xdest, ydest, width, height, source, xsrc, ysrc, rop=COPY, useMask=False, xsrcMask=-1, ysrcMask=-1)

Copy from a source DC to this DC. Parameters specify the destination coordinates, size of area to copy, source DC, source coordinates, logical function, whether to use a bitmap mask, and mask source position.

  Parameters:
    `xdest` - Destination device context x position.
    (type=int)

    `ydest` - Destination device context y position.
    (type=int)

    `width` - Width of source area to be copied.
    (type=int)

    `height` - Height of source area to be copied.
    (type=int)

    `source` - Source device context.
    (type=DC)

    `xsrc` - Source device context x position.
    (type=int)

    `ysrc` - Source device context y position.
    (type=int)

    `rop` - Logical function to use: see `SetLogicalFunction`.
    (type=int)

    `useMask` - If true, Blit does a transparent blit using the mask that is associated with the bitmap selected into the source device context.
    (type=bool)

    `xsrcMask` - Source x position on the mask. If both xsrcMask and ysrcMask are -1, xsrc and ysrc will be assumed for the mask source position.
    (type=int)

    `ysrcMask` - Source y position on the mask.
    (type=int)

  Returns:
    bool

### BlitPointSize(self, destPt, sz, source, srcPt, rop=COPY, useMask=False, srcPtMask=DefaultPosition)

Copy from a source DC to this DC. Parameters specify the destination coordinates, size of area to copy, source DC, source coordinates, logical function, whether to use a bitmap mask, and mask source position.

  Parameters:
    `destPt` - Destination device context position.
    (type=Point)

    `sz` - Size of source area to be copied.
    (type=Size)

    `source` - Source device context.
    (type=DC)

    `srcPt` - Source device context position.
    (type=Point)

    `rop` - Logical function to use: see `SetLogicalFunction`.
    (type=int)

    `useMask` - If true, Blit does a transparent blit using the mask that is associated with the bitmap selected into the source device context.
    (type=bool)

    `srcPtMask` - Source position on the mask.
    (type=Point)

  Returns:
    bool

### CalcBoundingBox(self, x, y)

Adds the specified point to the bounding box which can be retrieved with `MinX`, `MaxX` and `MinY`, `MaxY` or `GetBoundingBox` functions.

  Parameters:
    `x`
    (type=int)

    `y`
    (type=int)

### CalcBoundingBoxPoint(self, point)

Adds the specified point to the bounding box which can be retrieved with `MinX`, `MaxX` and `MinY`, `MaxY` or `GetBoundingBox` functions.

  Parameters:
    `point`
    (type=Point)

### Clear(self)

Clears the device context using the current background brush.

### ComputeScaleAndOrigin(self)

Performs all necessary computations for given platform and context type after each change of scale and origin parameters. Usually called automatically internally after such changes.

### CrossHair(self, x, y)

Displays a cross hair using the current pen. This is a vertical and horizontal line the height and width of the window, centred on the given point.

  Parameters:
    `x`
    (type=int)

    `y`
    (type=int)

### CrossHairPoint(self, pt)

Displays a cross hair using the current pen. This is a vertical and horizontal line the height and width of the window, centred on the given point.

  Parameters:
    `pt`
    (type=Point)

### DestroyClippingRegion(self)

Destroys the current clipping region so that none of the DC is clipped.

  See Also:

  `SetClippingRegion`

### DeviceToLogicalX(self, x)

Convert device X coordinate to logical coordinate, using the current mapping mode.

  Parameters:
    `x`
    (type=int)

  Returns:
    int

### DeviceToLogicalXRel(self, x)

Convert device X coordinate to relative logical coordinate, using the current mapping mode but ignoring the x axis orientation. Use this function for converting a width, for example.

  Parameters:
    `x`
    (type=int)

  Returns:
    int

### DeviceToLogicalY(self, y)

Converts device Y coordinate to logical coordinate, using the current mapping mode.

  Parameters:
    `y`
    (type=int)

  Returns:
    int

### DeviceToLogicalYRel(self, y)

Convert device Y coordinate to relative logical coordinate, using the current mapping mode but ignoring the y axis orientation. Use this function for converting a height, for example.

  Parameters:
    `y`
    (type=int)

  Returns:
    int

### DrawArc(self, x1, y1, x2, y2, xc, yc)

Draws an arc of a circle, centred on the center point (xc, yc), from the first point to the second. The current pen is used for the outline and the current brush for filling the shape.

The arc is drawn in an anticlockwise direction from the start point to the end point.

  Parameters:
    `x1`
    (type=int)

    `y1`
    (type=int)

    `x2`
    (type=int)

    `y2`
    (type=int)

    `xc`
    (type=int)

    `yc`
    (type=int)

### DrawArcPoint(self, pt1, pt2, center)

Draws an arc of a circle, centred on the center point (xc, yc), from the first point to the second. The current pen is used for the outline and the current brush for filling the shape.

The arc is drawn in an anticlockwise direction from the start point to the end point.

  Parameters:
    `pt1`
    (type=Point)

    `pt2`
    (type=Point)

    `center`
    (type=Point)

### DrawBitmap(self, bmp, x, y, useMask=False)

Draw a bitmap on the device context at the specified point. If transparent is true and the bitmap has a transparency mask, (or alpha channel on the platforms that support it) then the bitmap will be drawn transparently.

When drawing a mono-bitmap, the current text foreground colour will be used to draw the foreground of the bitmap (all bits set to 1), and the current text background colour to draw the background (all bits set to 0).

  Parameters:
    `bmp`
    (type=Bitmap)

    `x`
    (type=int)

    `y`
    (type=int)

    `useMask`
    (type=bool)

  See Also:

  `SetTextForeground`, `SetTextBackground` and `wx.MemoryDC`

### DrawBitmapPoint(self, bmp, pt, useMask=False)

Draw a bitmap on the device context at the specified point. If transparent is true and the bitmap has a transparency mask, (or alpha channel on the platforms that support it) then the bitmap will be drawn transparently.

When drawing a mono-bitmap, the current text foreground colour will be used to draw the foreground of the bitmap (all bits set to 1), and the current text background colour to draw the background (all bits set to 0).

  Parameters:
    `bmp`
    (type=Bitmap)

    `pt`
    (type=Point)

    `useMask`
    (type=bool)

  See Also:

  `SetTextForeground`, `SetTextBackground` and `wx.MemoryDC`

### DrawCheckMark(self, x, y, width, height)

Draws a check mark inside the given rectangle.

  Parameters:
    `x`
    (type=int)

    `y`
    (type=int)

    `width`
    (type=int)

    `height`
    (type=int)

### DrawCheckMarkRect(self, rect)

Draws a check mark inside the given rectangle.

  Parameters:
    `rect`
    (type=Rect)

### DrawCircle(self, x, y, radius)

Draws a circle with the given center point and radius. The current pen is used for the outline and the current brush for filling the shape.

  Parameters:
    `x`
    (type=int)

    `y`
    (type=int)

    `radius`
    (type=int)

  See Also:

  `DrawEllipse`

### DrawCirclePoint(self, pt, radius)

Draws a circle with the given center point and radius. The current pen is used for the outline and the current brush for filling the shape.

  Parameters:
    `pt`
    (type=Point)

    `radius`
    (type=int)

  See Also:

  `DrawEllipse`

### DrawEllipse(self, x, y, width, height)

Draws an ellipse contained in the specified rectangle. The current pen is used for the outline and the current brush for filling the shape.

  Parameters:
    `x`
    (type=int)

    `y`
    (type=int)

    `width`
    (type=int)

    `height`
    (type=int)

  See Also:

  `DrawCircle`

### DrawEllipseList(self, ellipses, pens=None, brushes=None)

Draw a list of ellipses as quickly as possible.

  Parameters:
    `ellipses` - A sequence of 4-element sequences representing each ellipse to draw, (x,y, w,h).

    `pens` - If None, then the current pen is used. If a single pen then it will be used for all ellipses. If a list of pens then there should be one for each ellipse in ellipses.

    `brushes` - A brush or brushes to be used to fill the ellipses, with similar semantics as the pens parameter.

### DrawEllipsePointSize(self, pt, sz)

Draws an ellipse contained in the specified rectangle. The current pen is used for the outline and the current brush for filling the shape.

  Parameters:
    `pt`
    (type=Point)

    `sz`
    (type=Size)

  See Also:

  `DrawCircle`

### DrawEllipseRect(self, rect)

Draws an ellipse contained in the specified rectangle. The current pen is used for the outline and the current brush for filling the shape.

  Parameters:
    `rect`
    (type=Rect)

  See Also:

  `DrawCircle`

### DrawEllipticArc(self, x, y, w, h, start, end)

Draws an arc of an ellipse, with the given rectangle defining the bounds of the ellipse. The current pen is used for drawing the arc and the current brush is used for drawing the pie.

The start and end parameters specify the start and end of the arc relative to the three-o'clock position from the center of the rectangle. Angles are specified in degrees (360 is a complete circle). Positive values mean counter-clockwise motion. If start is equal to end, a complete ellipse will be drawn.

  Parameters:
    `x`
    (type=int)

    `y`
    (type=int)

    `w`
    (type=int)

    `h`
    (type=int)

    `start`
    (type=double)

    `end`
    (type=double)

### DrawEllipticArcPointSize(self, pt, sz, start, end)

Draws an arc of an ellipse, with the given rectangle defining the bounds of the ellipse. The current pen is used for drawing the arc and the current brush is used for drawing the pie.

The start and end parameters specify the start and end of the arc relative to the three-o'clock position from the center of the rectangle. Angles are specified in degrees (360 is a complete circle). Positive values mean counter-clockwise motion. If start is equal to end, a complete ellipse will be drawn.

  Parameters:
    `pt`
    (type=Point)

    `sz`
    (type=Size)

    `start`
    (type=double)

    `end`
    (type=double)

### DrawIcon(self, icon, x, y)

Draw an icon on the display (does nothing if the device context is PostScript). This can be the simplest way of drawing bitmaps on a window.

  Parameters:
    `icon`
    (type=Icon)

    `x`
    (type=int)

    `y`
    (type=int)

### DrawIconPoint(self, icon, pt)

Draw an icon on the display (does nothing if the device context is PostScript). This can be the simplest way of drawing bitmaps on a window.

  Parameters:
    `icon`
    (type=Icon)

    `pt`
    (type=Point)

### DrawImageLabel(self, text, image, rect, alignment=wxALIGN_LEFT|wxALIGN_TOP, indexAccel=-1)

Draw text and an image (which may be `wx.NullBitmap` to skip drawing it) within the specified rectangle, abiding by the alignment flags. Will additionally emphasize the character at indexAccel if it is not -1. Returns the bounding rectangle.

  Parameters:
    `text`
    (type=String)

    `image`
    (type=Bitmap)

    `rect`
    (type=Rect)

    `alignment`
    (type=int)

    `indexAccel`
    (type=int)

  Returns:
    Rect

### DrawLabel(self, text, rect, alignment=wxALIGN_LEFT|wxALIGN_TOP, indexAccel=-1)

Draw text within the specified rectangle, abiding by the alignment flags. Will additionally emphasize the character at indexAccel if it is not -1.

  Parameters:
    `text`
    (type=String)

    `rect`
    (type=Rect)

    `alignment`
    (type=int)

    `indexAccel`
    (type=int)

  See Also:

  `DrawImageLabel`

### DrawLine(self, x1, y1, x2, y2)

Draws a line from the first point to the second. The current pen is used for drawing the line. Note that the second point is not part of the line and is not drawn by this function (this is consistent with the behaviour of many other toolkits).

  Parameters:
    `x1`
    (type=int)

    `y1`
    (type=int)

    `x2`
    (type=int)

    `y2`
    (type=int)

### DrawLineList(self, lines, pens=None)

Draw a list of lines as quickly as possible.

  Parameters:
    `lines` - A sequence of 4-element sequences representing each line to draw, (x1,y1, x2,y2).

    `pens` - If None, then the current pen is used. If a single pen then it will be used for all lines. If a list of pens then there should be one for each line in lines.

### DrawLinePoint(self, pt1, pt2)

Draws a line from the first point to the second. The current pen is used for drawing the line. Note that the second point is not part of the line and is not drawn by this function (this is consistent with the behaviour of many other toolkits).

  Parameters:
    `pt1`
    (type=Point)

    `pt2`
    (type=Point)

### DrawLines(self, points, xoffset=0, yoffset=0)

Draws lines using a sequence of `wx.Point` objects, adding the optional offset coordinate. The current pen is used for drawing the lines.

  Parameters:
    `points`
    (type=List)

    `xoffset`
    (type=int)

    `yoffset`
    (type=int)

### DrawPoint(self, x, y)

Draws a point using the current pen.

  Parameters:
    `x`
    (type=int)

    `y`
    (type=int)

### DrawPointList(self, points, pens=None)

Draw a list of points as quickly as possible.

  Parameters:
    `points` - A sequence of 2-element sequences representing each point to draw, (x,y).

    `pens` - If None, then the current pen is used. If a single pen then it will be used for all points. If a list of pens then there should be one for each point in points.

### DrawPointPoint(self, pt)

Draws a point using the current pen.

  Parameters:
    `pt`
    (type=Point)

### DrawPolygon(self, points, xoffset=0, yoffset=0, fillStyle=ODDEVEN_RULE)

Draws a filled polygon using a sequence of `wx.Point` objects, adding the optional offset coordinate. The last argument specifies the fill rule: `wx.ODDEVEN_RULE` (the default) or `wx.WINDING_RULE`.

The current pen is used for drawing the outline, and the current brush for filling the shape. Using a transparent brush suppresses filling. Note that wxWidgets automatically closes the first and last points.

  Parameters:
    `points`
    (type=List)

    `xoffset`
    (type=int)

    `yoffset`
    (type=int)

    `fillStyle`
    (type=int)

### DrawPolygonList(self, polygons, pens=None, brushes=None)

Draw a list of polygons, each of which is a list of points.

  Parameters:
    `polygons` - A sequence of sequences of sequences. [[(x1,y1),(x2,y2),(x3,y3)...], [(x1,y1),(x2,y2),(x3,y3)...]]

    `pens` - If None, then the current pen is used. If a single pen then it will be used for all polygons. If a list of pens then there should be one for each polygon.

    `brushes` - A brush or brushes to be used to fill the polygons, with similar semantics as the pens parameter.

### DrawRectangle(self, x, y, width, height)

Draws a rectangle with the given top left corner, and with the given size. The current pen is used for the outline and the current brush for filling the shape.

  Parameters:
    `x`
    (type=int)

    `y`
    (type=int)

    `width`
    (type=int)

    `height`
    (type=int)

### DrawRectangleList(self, rectangles, pens=None, brushes=None)

Draw a list of rectangles as quickly as possible.

  Parameters:
    `rectangles` - A sequence of 4-element sequences representing each rectangle to draw, (x,y, w,h).

    `pens` - If None, then the current pen is used. If a single pen then it will be used for all rectangles. If a list of pens then there should be one for each rectangle in rectangles.

    `brushes` - A brush or brushes to be used to fill the rectagles, with similar semantics as the pens parameter.

### DrawRectanglePointSize(self, pt, sz)

Draws a rectangle with the given top left corner, and with the given size. The current pen is used for the outline and the current brush for filling the shape.

  Parameters:
    `pt`
    (type=Point)

    `sz`
    (type=Size)

### DrawRectangleRect(self, rect)

Draws a rectangle with the given top left corner, and with the given size. The current pen is used for the outline and the current brush for filling the shape.

  Parameters:
    `rect`
    (type=Rect)

### DrawRotatedText(self, text, x, y, angle)

Draws the text rotated by angle degrees, if supported by the platform.

NOTE: Under Win9x only TrueType fonts can be drawn by this function. In particular, a font different from `wx.NORMAL_FONT` should be used as the it is not normally a TrueType font. `wx.SWISS_FONT` is an example of a font which is.

  Parameters:
    `text`
    (type=String)

    `x`
    (type=int)

    `y`
    (type=int)

    `angle`
    (type=double)

  See Also:

  `DrawText`

### DrawRotatedTextPoint(self, text, pt, angle)

Draws the text rotated by angle degrees, if supported by the platform.

NOTE: Under Win9x only TrueType fonts can be drawn by this function. In particular, a font different from `wx.NORMAL_FONT` should be used as the it is not normally a TrueType font. `wx.SWISS_FONT` is an example of a font which is.

  Parameters:
    `text`
    (type=String)

    `pt`
    (type=Point)

    `angle`
    (type=double)

  See Also:

  `DrawText`

### DrawRoundedRectangle(self, x, y, width, height, radius)

Draws a rectangle with the given top left corner, and with the given size. The corners are quarter-circles using the given radius. The current pen is used for the outline and the current brush for filling the shape.

If radius is positive, the value is assumed to be the radius of the rounded corner. If radius is negative, the absolute value is assumed to be the proportion of the smallest dimension of the rectangle. This means that the corner can be a sensible size relative to the size of the rectangle, and also avoids the strange effects X produces when the corners are too big for the rectangle.

  Parameters:
    `x`
    (type=int)

    `y`
    (type=int)

    `width`
    (type=int)

    `height`
    (type=int)

    `radius`
    (type=double)

### DrawRoundedRectanglePointSize(self, pt, sz, radius)

Draws a rectangle with the given top left corner, and with the given size. The corners are quarter-circles using the given radius. The current pen is used for the outline and the current brush for filling the shape.

If radius is positive, the value is assumed to be the radius of the rounded corner. If radius is negative, the absolute value is assumed to be the proportion of the smallest dimension of the rectangle. This means that the corner can be a sensible size relative to the size of the rectangle, and also avoids the strange effects X produces when the corners are too big for the rectangle.

  Parameters:
    `pt`
    (type=Point)

    `sz`
    (type=Size)

    `radius`
    (type=double)

### DrawRoundedRectangleRect(self, r, radius)

Draws a rectangle with the given top left corner, and with the given size. The corners are quarter-circles using the given radius. The current pen is used for the outline and the current brush for filling the shape.

If radius is positive, the value is assumed to be the radius of the rounded corner. If radius is negative, the absolute value is assumed to be the proportion of the smallest dimension of the rectangle. This means that the corner can be a sensible size relative to the size of the rectangle, and also avoids the strange effects X produces when the corners are too big for the rectangle.

  Parameters:
    `r`
    (type=Rect)

    `radius`
    (type=double)

### DrawSpline(self, points)

Draws a spline between all given control points, (a list of `wx.Point` objects) using the current pen. The spline is drawn using a series of lines, using an algorithm taken from the X drawing program 'XFIG'.

  Parameters:
    `points`
    (type=List)

### DrawText(self, text, x, y)

Draws a text string at the specified point, using the current text font, and the current text foreground and background colours.

The coordinates refer to the top-left corner of the rectangle bounding the string. See `GetTextExtent` for how to get the dimensions of a text string, which can be used to position the text more precisely.

NOTE: under wxGTK the current logical function is used by this function but it is ignored by wxMSW. Thus, you should avoid using logical functions with this function in portable programs.

  Parameters:
    `text`
    (type=String)

    `x`
    (type=int)

    `y`
    (type=int)

  See Also:

  `DrawRotatedText`

### DrawTextList(self, textList, coords, foregrounds=None, backgrounds=None)

Draw a list of strings using a list of coordinants for positioning each string.

NOTE: Make sure you set Background mode to wx.Solid (DC.SetBackgroundMode)
  If you want backgrounds to do anything.

  Parameters:
    `textList` - A list of strings

    `coords` - A list of (x,y) positions

    `foregrounds` - A list of `wx.Colour` objects to use for the foregrounds of the strings.

    `backgrounds` - A list of `wx.Colour` objects to use for the backgrounds of the strings.

### DrawTextPoint(self, text, pt)

Draws a text string at the specified point, using the current text font, and the current text foreground and background colours.

The coordinates refer to the top-left corner of the rectangle bounding the string. See `GetTextExtent` for how to get the dimensions of a text string, which can be used to position the text more precisely.

NOTE: under wxGTK the current logical function is used by this function but it is ignored by wxMSW. Thus, you should avoid using logical functions with this function in portable programs.

  Parameters:
    `text`
    (type=String)

    `pt`
    (type=Point)

  See Also:

  `DrawRotatedText`

### EndDoc(self)

Ends a document (only relevant when outputting to a printer).

### EndPage(self)

Ends a document page (only relevant when outputting to a printer).

### FloodFill(self, x, y, col, style=FLOOD_SURFACE)

Flood fills the device context starting from the given point, using the current brush colour, and using a style:

> - wxFLOOD_SURFACE: the flooding occurs until a colour other than the given colour is encountered.
> - wxFLOOD_BORDER: the area to be flooded is bounded by the given colour.

Returns False if the operation failed.

Note: The present implementation for non-Windows platforms may fail to find colour borders if the pixels do not match the colour exactly. However the function will still return true.

  Parameters:
    `x`
    (type=int)

    `y`
    (type=int)

    `col`
    (type=Colour)

    `style`
    (type=int)

  Returns:
    bool

### FloodFillPoint(self, pt, col, style=FLOOD_SURFACE)

Flood fills the device context starting from the given point, using the current brush colour, and using a style:

> - wxFLOOD_SURFACE: the flooding occurs until a colour other than the given colour is encountered.
> - wxFLOOD_BORDER: the area to be flooded is bounded by the given colour.

Returns False if the operation failed.

Note: The present implementation for non-Windows platforms may fail to find colour borders if the pixels do not match the colour exactly. However the function will still return true.

  Parameters:
    `pt`
    (type=Point)

    `col`
    (type=Colour)

    `style`
    (type=int)

  Returns:
    bool

### GetBackground(self)

Gets the brush used for painting the background.

  Returns:
    Brush

  See Also:

  `SetBackground`

### GetBackgroundMode(self)

Returns the current background mode, either `wx.SOLID` or `wx.TRANSPARENT`.

  Returns:
    int

  See Also:

  `SetBackgroundMode`

### GetBoundingBox()

Returns the min and max points used in drawing commands so far.

  Returns:
    (x1,y1, x2,y2)

### GetBrush(self)

Gets the current brush

  Returns:
    Brush

### GetCharHeight(self)

Gets the character height of the currently set font.

  Returns:
    int

### GetCharWidth(self)

Gets the average character width of the currently set font.

  Returns:
    int

### GetClippingBox()

Gets the rectangle surrounding the current clipping region.

  Returns:
    (x, y, width, height)

### GetClippingRect(self)

Gets the rectangle surrounding the current clipping region.

  Returns:
    Rect

### GetDepth(self)

Returns the colour depth of the DC.

  Returns:
    int

### GetFont(self)

Gets the current font

  Returns:
    Font

### GetFullTextExtent(string, font=None)

Get the width, height, decent and leading of the text using the current or specified font. Only works for single line strings.

  Parameters:
    `string`
    (type=wxString)

    `font`
    (type=Font)

  Returns:
    (width, height, descent, externalLeading)

### GetLayoutDirection(self)

Get the layout direction (LTR or RTL)_ for this dc. On platforms where RTL layout is supported, the return value will either be `wx.Layout_LeftToRight` or `wx.Layout_RightToLeft`. `wx.Layout_Default` is returned if layout direction is not supported.

  Returns:
    int

### GetLogicalFunction(self)

Gets the current logical function (set by `SetLogicalFunction`).

  Returns:
    int

### GetMapMode(self)

Gets the current mapping mode for the device context

  Returns:
    int

### GetMultiLineTextExtent(string, font=None)

Get the width, height, and line height of the text using the current or specified font. Works for single as well as multi-line strings.

  Parameters:
    `string`
    (type=wxString)

    `font`
    (type=Font)

  Returns:
    (width, height, lineHeight)

### GetOptimization(*args, **kwargs)

<function GetOptimization at 0xb7a83bc4> is deprecated

### GetPartialTextExtents(self, text)

Returns a list of integers such that each value is the distance in pixels from the begining of text to the coresponding character of text. The generic version simply builds a running total of the widths of each character using GetTextExtent, however if the various platforms have a native API function that is faster or more accurate than the generic implementation then it will be used instead.

  Returns:
    [widths]

### GetPen(self)

Gets the current pen

  Returns:
    Pen

### GetPixel(self, x, y)

Gets the colour at the specified location on the DC.

  Parameters:
    `x`
    (type=int)

    `y`
    (type=int)

  Returns:
    Colour

### GetPPI(self)

Resolution in pixels per inch

  Returns:
    Size

### GetSize(self)

This gets the horizontal and vertical resolution in device units. It can be used to scale graphics to fit the page. For example, if maxX and maxY represent the maximum horizontal and vertical 'pixel' values used in your application, the following code will scale the graphic to fit on the printer page:

    w, h = dc.GetSize()
    scaleX = maxX*1.0 / w
    scaleY = maxY*1.0 / h
    dc.SetUserScale(min(scaleX,scaleY),min(scaleX,scaleY))

  Returns:
    Size

### GetSizeMM(self)

Get the DC size in milimeters.

  Returns:
    Size

### GetSizeMMTuple()

Get the DC size in milimeters.

  Returns:
    (width, height)

### GetSizeTuple()

This gets the horizontal and vertical resolution in device units. It can be used to scale graphics to fit the page. For example, if maxX and maxY represent the maximum horizontal and vertical 'pixel' values used in your application, the following code will scale the graphic to fit on the printer page:

    w, h = dc.GetSize()
    scaleX = maxX*1.0 / w
    scaleY = maxY*1.0 / h
    dc.SetUserScale(min(scaleX,scaleY),min(scaleX,scaleY))

  Returns:
    (width, height)

### GetTextBackground(self)

Gets the current text background colour

  Returns:
    Colour

### GetTextExtent(string)

Get the width and height of the text using the current font. Only works for single line strings.

  Parameters:
    `string`
    (type=wxString)

  Returns:
    (width, height)

### GetTextForeground(self)

Gets the current text foreground colour

  Returns:
    Colour

### GetUserScale(self)

Gets the current user scale factor (set by `SetUserScale`).

  Returns:
    (xScale, yScale)

### GradientFillConcentric(self, rect, initialColour, destColour, circleCenter)

Fill the area specified by rect with a radial gradient, starting from initialColour in the center of the circle and fading to destColour on the outside of the circle. The circleCenter argument is the relative coordinants of the center of the circle in the specified rect.

Note: Currently this function is very slow, don't use it for real-time drawing.

  Parameters:
    `rect`
    (type=Rect)

    `initialColour`
    (type=Colour)

    `destColour`
    (type=Colour)

    `circleCenter`
    (type=Point)

### GradientFillLinear(self, rect, initialColour, destColour, nDirection=EAST)

Fill the area specified by rect with a linear gradient, starting from initialColour and eventually fading to destColour. The nDirection parameter specifies the direction of the colour change, default is to use initialColour on the left part of the rectangle and destColour on the right side.

  Parameters:
    `rect`
    (type=Rect)

    `initialColour`
    (type=Colour)

    `destColour`
    (type=Colour)

    `nDirection`
    (type=int)

### IsOk(self)

Returns true if the DC is ok to use.

  Returns:
    bool

### LogicalToDeviceX(self, x)

Converts logical X coordinate to device coordinate, using the current mapping mode.

  Parameters:
    `x`
    (type=int)

  Returns:
    int

### LogicalToDeviceXRel(self, x)

Converts logical X coordinate to relative device coordinate, using the current mapping mode but ignoring the x axis orientation. Use this for converting a width, for example.

  Parameters:
    `x`
    (type=int)

  Returns:
    int

### LogicalToDeviceY(self, y)

Converts logical Y coordinate to device coordinate, using the current mapping mode.

  Parameters:
    `y`
    (type=int)

  Returns:
    int

### LogicalToDeviceYRel(self, y)

Converts logical Y coordinate to relative device coordinate, using the current mapping mode but ignoring the y axis orientation. Use this for converting a height, for example.

  Parameters:
    `y`
    (type=int)

  Returns:
    int

### MaxX(self)

Gets the maximum horizontal extent used in drawing commands so far.

  Returns:
    int

### MaxY(self)

Gets the maximum vertical extent used in drawing commands so far.

  Returns:
    int

### MinX(self)

Gets the minimum horizontal extent used in drawing commands so far.

  Returns:
    int

### MinY(self)

Gets the minimum vertical extent used in drawing commands so far.

  Returns:
    int

### Ok(self)

Returns true if the DC is ok to use.

  Returns:
    bool

### ResetBoundingBox(self)

Resets the bounding box: after a call to this function, the bounding box doesn't contain anything.

### SetAxisOrientation(self, xLeftRight, yBottomUp)

Sets the x and y axis orientation (i.e., the direction from lowest to highest values on the axis). The default orientation is the natural orientation, e.g. x axis from left to right and y axis from bottom up.

  Parameters:
    `xLeftRight`
    (type=bool)

    `yBottomUp`
    (type=bool)

### SetBackground(self, brush)

Sets the current background brush for the DC.

  Parameters:
    `brush`
    (type=Brush)

### SetBackgroundMode(self, mode)

mode may be one of `wx.SOLID` and `wx.TRANSPARENT`. This setting determines whether text will be drawn with a background colour or not.

  Parameters:
    `mode`
    (type=int)

### SetBrush(self, brush)

Sets the current brush for the DC.

If the argument is `wx.NullBrush`, the current brush is selected out of the device context, and the original brush restored, allowing the current brush to be destroyed safely.

  Parameters:
    `brush`
    (type=Brush)

  See Also:

  `wx.Brush`

### SetClippingRect(self, rect)

Sets the clipping region for this device context to the intersection of the given region described by the parameters of this method and the previously set clipping region. You should call `DestroyClippingRegion` if you want to set the clipping region exactly to the region specified.

The clipping region is an area to which drawing is restricted. Possible uses for the clipping region are for clipping text or for speeding up window redraws when only a known area of the screen is damaged.

  Parameters:
    `rect`
    (type=Rect)

  See Also:

  `DestroyClippingRegion`, `wx.Region`

### SetClippingRegion(self, x, y, width, height)

Sets the clipping region for this device context to the intersection of the given region described by the parameters of this method and the previously set clipping region. You should call `DestroyClippingRegion` if you want to set the clipping region exactly to the region specified.

The clipping region is an area to which drawing is restricted. Possible uses for the clipping region are for clipping text or for speeding up window redraws when only a known area of the screen is damaged.

  Parameters:
    `x`
    (type=int)

    `y`
    (type=int)

    `width`
    (type=int)

    `height`
    (type=int)

  See Also:

  `DestroyClippingRegion`, `wx.Region`

### SetClippingRegionAsRegion(self, region)

Sets the clipping region for this device context to the intersection of the given region described by the parameters of this method and the previously set clipping region. You should call `DestroyClippingRegion` if you want to set the clipping region exactly to the region specified.

The clipping region is an area to which drawing is restricted. Possible uses for the clipping region are for clipping text or for speeding up window redraws when only a known area of the screen is damaged.

  Parameters:
    `region`
    (type=Region)

  See Also:

  `DestroyClippingRegion`, `wx.Region`

### SetClippingRegionPointSize(self, pt, sz)

Sets the clipping region for this device context to the intersection of the given region described by the parameters of this method and the previously set clipping region. You should call `DestroyClippingRegion` if you want to set the clipping region exactly to the region specified.

The clipping region is an area to which drawing is restricted. Possible uses for the clipping region are for clipping text or for speeding up window redraws when only a known area of the screen is damaged.

  Parameters:
    `pt`
    (type=Point)

    `sz`
    (type=Size)

  See Also:

  `DestroyClippingRegion`, `wx.Region`

### SetFont(self, font)

Sets the current font for the DC. It must be a valid font, in particular you should not pass `wx.NullFont` to this method.

  Parameters:
    `font`
    (type=Font)

  See Also:

  `wx.Font`

### SetLayoutDirection(self, dir)

Change the layout direction for this dc.

  Parameters:
    `dir`
    (type=int)

### SetLogicalFunction(self, function)

Sets the current logical function for the device context. This determines how a source pixel (from a pen or brush colour, or source device context if using `Blit`) combines with a destination pixel in the current device context.

The possible values and their meaning in terms of source and destination pixel values are as follows:

> wx.AND | src AND dst
> wx.AND_INVERT | (NOT src) AND dst
> wx.AND_REVERSE | src AND (NOT dst)
> wx.CLEAR | 0
> wx.COPY | src
> wx.EQUIV | (NOT src) XOR dst
> wx.INVERT | NOT dst
> wx.NAND | (NOT src) OR (NOT dst)
> wx.NOR | (NOT src) AND (NOT dst)
> wx.NO_OP | dst
> wx.OR | src OR dst
> wx.OR_INVERT | (NOT src) OR dst
> wx.OR_REVERSE | src OR (NOT dst)
> wx.SET | 1
> wx.SRC_INVERT | NOT src
> wx.XOR | src XOR dst

The default is wx.COPY, which simply draws with the current colour. The others combine the current colour and the background using a logical operation. wx.INVERT is commonly used for drawing rubber bands or moving outlines, since drawing twice reverts to the original colour.

  Parameters:
    `function`
    (type=int)

### SetMapMode(self, mode)

The mapping mode of the device context defines the unit of measurement used to convert logical units to device units. The mapping mode can be one of the following:

> wx.MM_TWIPS | Each logical unit is 1/20 of a point, or 1/1440 of an inch.
> wx.MM_POINTS | Each logical unit is a point, or 1/72 of an inch.
> wx.MM_METRIC | Each logical unit is 1 mm.
> wx.MM_LOMETRIC | Each logical unit is 1/10 of a mm.
> wx.MM_TEXT | Each logical unit is 1 pixel.

Note that in X, text drawing isn't handled consistently with the mapping mode; a font is always specified in point size. However, setting the user scale (see `SetUserScale`) scales the text appropriately. In Windows, scalable TrueType fonts are always used; in X, results depend on availability of fonts, but usually a reasonable match is found.

The coordinate origin is always at the top left of the screen/printer.

Drawing to a Windows printer device context uses the current mapping mode, but mapping mode is currently ignored for PostScript output.

  Parameters:
    `mode`
    (type=int)

### SetOptimization(*args, **kwargs)

<function SetOptimization at 0xb7a83b8c> is deprecated

### SetPalette(self, palette)

If this is a window DC or memory DC, assigns the given palette to the window or bitmap associated with the DC. If the argument is `wx.NullPalette`, the current palette is selected out of the device context, and the original palette restored.

  Parameters:
    `palette`
    (type=Palette)

  See Also:

  `wx.Palette`

### SetPen(self, pen)

Sets the current pen for the DC.

If the argument is `wx.NullPen`, the current pen is selected out of the device context, and the original pen restored.

  Parameters:
    `pen`
    (type=Pen)

  See Also:

  `wx.Pen`

### SetTextBackground(self, colour)

Sets the current text background colour for the DC.

  Parameters:
    `colour`
    (type=Colour)

### SetTextForeground(self, colour)

Sets the current text foreground colour for the DC.

  Parameters:
    `colour`
    (type=Colour)

### SetUserScale(self, x, y)

Sets the user scaling factor, useful for applications which require 'zooming'.

  Parameters:
    `x`
    (type=double)

    `y`
    (type=double)

### StartDoc(self, message)

Starts a document (only relevant when outputting to a printer). Message is a message to show whilst printing.

  Parameters:
    `message`
    (type=String)

  Returns:
    bool

### StartPage(self)

Starts a document page (only relevant when outputting to a printer).

Property Details

### Background

See `GetBackground` and `SetBackground`

  Get Method:
    `GetBackground`(self)
  Set Method:
    `SetBackground`(self, brush)

### BackgroundMode

See `GetBackgroundMode` and `SetBackgroundMode`

  Get Method:
    `GetBackgroundMode`(self)
  Set Method:
    `SetBackgroundMode`(self, mode)

### BoundingBox

See `GetBoundingBox`

  Get Method:
    `GetBoundingBox`()

### Brush

See `GetBrush` and `SetBrush`

  Get Method:
    `GetBrush`(self)
  Set Method:
    `SetBrush`(self, brush)

### CharHeight

See `GetCharHeight`

  Get Method:
    `GetCharHeight`(self)

### CharWidth

See `GetCharWidth`

  Get Method:
    `GetCharWidth`(self)

### ClippingBox

See `GetClippingBox`

  Get Method:
    `GetClippingBox`()

### ClippingRect

See `GetClippingRect` and `SetClippingRect`

  Get Method:
    `GetClippingRect`(self)
  Set Method:
    `SetClippingRect`(self, rect)

### Depth

See `GetDepth`

  Get Method:
    `GetDepth`(self)

### DeviceOrigin

See `GetDeviceOrigin` and `SetDeviceOrigin`

  Get Method:
    `GetDeviceOrigin`(self)
  Set Method:
    `SetDeviceOrigin`(self, x, y)

### Font

See `GetFont` and `SetFont`

  Get Method:
    `GetFont`(self)
  Set Method:
    `SetFont`(self, font)

### FullTextExtent

See `GetFullTextExtent`

  Get Method:
    `GetFullTextExtent`(string, font)

### LayoutDirection

  Get Method:
    `GetLayoutDirection`(self)
  Set Method:
    `SetLayoutDirection`(self, dir)

### LogicalFunction

See `GetLogicalFunction` and `SetLogicalFunction`

  Get Method:
    `GetLogicalFunction`(self)
  Set Method:
    `SetLogicalFunction`(self, function)

### LogicalOrigin

See `GetLogicalOrigin` and `SetLogicalOrigin`

  Get Method:
    `GetLogicalOrigin`(self)
  Set Method:
    `SetLogicalOrigin`(self, x, y)

### LogicalScale

See `GetLogicalScale` and `SetLogicalScale`

  Get Method:
    `GetLogicalScale`()
  Set Method:
    `SetLogicalScale`(self, x, y)

### MapMode

See `GetMapMode` and `SetMapMode`

  Get Method:
    `GetMapMode`(self)
  Set Method:
    `SetMapMode`(self, mode)

### MultiLineTextExtent

See `GetMultiLineTextExtent`

  Get Method:
    `GetMultiLineTextExtent`(string, font)

### Optimization

See `GetOptimization` and `SetOptimization`

  Get Method:
    `deprecatedWrapper`(*args, **kwargs)
  Set Method:
    `deprecatedWrapper`(*args, **kwargs)

### PartialTextExtents

See `GetPartialTextExtents`

  Get Method:
    `GetPartialTextExtents`(self, text)

### Pen

See `GetPen` and `SetPen`

  Get Method:
    `GetPen`(self)
  Set Method:
    `SetPen`(self, pen)

### Pixel

See `GetPixel`

  Get Method:
    `GetPixel`(self, x, y)

### PixelPoint

See `GetPixelPoint`

  Get Method:
    `GetPixelPoint`(self, pt)

### PPI

See `GetPPI`

  Get Method:
    `GetPPI`(self)

### Size

See `GetSize`

  Get Method:
    `GetSize`(self)

### SizeMM

See `GetSizeMM`

  Get Method:
    `GetSizeMM`(self)

### TextBackground

See `GetTextBackground` and `SetTextBackground`

  Get Method:
    `GetTextBackground`(self)
  Set Method:
    `SetTextBackground`(self, colour)

### TextExtent

See `GetTextExtent`

  Get Method:
    `GetTextExtent`(string)

### TextForeground

See `GetTextForeground` and `SetTextForeground`

  Get Method:
    `GetTextForeground`(self)
  Set Method:
    `SetTextForeground`(self, colour)

### thisown

The membership flag

### UserScale

See `GetUserScale` and `SetUserScale`

  Get Method:
    `GetUserScale`(self)
  Set Method:
    `SetUserScale`(self, x, y)

Generated by Epydoc 2.1.20050511.rpd on Thu Mar 22 12:07:47 2007 | http://epydoc.sf.net