Home | Trees | Index | Help |
|
---|
Package wx :: Module _gdi :: Class DC |
|
object
--+ |Object
--+ | DC
MemoryDC
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)
| |
__repr__(self)
| |
_DrawEllipseList(self, PyObject pyCoords, PyObject pyPens, PyObject pyBrushes) -> PyObject | |
_DrawLineList(self, PyObject pyCoords, PyObject pyPens, PyObject pyBrushes) -> PyObject | |
_DrawPointList(self, PyObject pyCoords, PyObject pyPens, PyObject pyBrushes) -> PyObject | |
_DrawPolygonList(self, PyObject pyCoords, PyObject pyPens, PyObject pyBrushes) -> PyObject | |
_DrawRectangleList(self, PyObject pyCoords, PyObject pyPens, PyObject pyBrushes) -> PyObject | |
_DrawTextList(self, PyObject textList, PyObject pyPoints, PyObject foregroundList, ... | |
BeginDrawing(self) | |
Blit(self, int xdest, int ydest, int width, int height, DC source, int xsrc, int ysrc, int rop=COPY, bool useMask=False, int xsrcMask=-1, int ysrcMask=-1) -> bool Copy from a source DC to this DC. | |
BlitPointSize(self, Point destPt, Size sz, DC source, Point srcPt, int rop=COPY, bool useMask=False, Point srcPtMask=DefaultPosition) -> bool Copy from a source DC to this DC. | |
CalcBoundingBox(self, int x, int y) | |
CalcBoundingBoxPoint(self, Point point) | |
CanDrawBitmap(self) -> bool | |
CanGetTextExtent(self) -> bool | |
Clear(self) | |
ComputeScaleAndOrigin(self) | |
CrossHair(self, int x, int y) | |
CrossHairPoint(self, Point pt) | |
DestroyClippingRegion(self) | |
DeviceToLogicalX(self, int x) -> int | |
DeviceToLogicalXRel(self, int x) -> int | |
DeviceToLogicalY(self, int y) -> int | |
DeviceToLogicalYRel(self, int y) -> int | |
DrawArc(self, int x1, int y1, int x2, int y2, int xc, int yc) | |
DrawArcPoint(self, Point pt1, Point pt2, Point center) | |
DrawBitmap(self, Bitmap bmp, int x, int y, bool useMask=False) | |
DrawBitmapPoint(self, Bitmap bmp, Point pt, bool useMask=False) | |
DrawCheckMark(self, int x, int y, int width, int height) | |
DrawCheckMarkRect(self, Rect rect) | |
DrawCircle(self, int x, int y, int radius) | |
DrawCirclePoint(self, Point pt, int radius) | |
DrawEllipse(self, int x, int y, int width, int height) | |
Draw a list of ellipses as quickly as possible. | |
DrawEllipsePointSize(self, Point pt, Size sz) | |
DrawEllipseRect(self, Rect rect) | |
DrawEllipticArc(self, int x, int y, int w, int h, double start, double end) | |
DrawEllipticArcPointSize(self, Point pt, Size sz, double start, double end) | |
DrawIcon(self, Icon icon, int x, int y) | |
DrawIconPoint(self, Icon icon, Point pt) | |
DrawImageLabel(self, String text, Bitmap image, Rect rect, int alignment=wxALIGN_LEFT|wxALIGN_TOP, int indexAccel=-1) -> Rect 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, String text, Rect rect, int alignment=wxALIGN_LEFT|wxALIGN_TOP, int indexAccel=-1) Draw *text* within the specified rectangle, abiding by the alignment flags. | |
DrawLine(self, int x1, int y1, int x2, int y2) | |
Draw a list of lines as quickly as possible. | |
DrawLinePoint(self, Point pt1, Point pt2) | |
DrawLines(self, List points, int xoffset=0, int yoffset=0) | |
DrawPoint(self, int x, int y) | |
Draw a list of points as quickly as possible. | |
DrawPointPoint(self, Point pt) | |
DrawPolygon(self, List points, int xoffset=0, int yoffset=0, int fillStyle=ODDEVEN_RULE) Draws a filled polygon using a sequence of `wx.Point` objects, adding the optional offset coordinate. | |
Draw a list of polygons, each of which is a list of points. | |
DrawRectangle(self, int x, int y, int width, int height) | |
Draw a list of rectangles as quickly as possible. | |
DrawRectanglePointSize(self, Point pt, Size sz) | |
DrawRectangleRect(self, Rect rect) | |
DrawRotatedText(self, String text, int x, int y, double angle) | |
DrawRotatedTextPoint(self, String text, Point pt, double angle) | |
DrawRoundedRectangle(self, int x, int y, int width, int height, double radius) | |
DrawRoundedRectanglePointSize(self, Point pt, Size sz, double radius) | |
DrawRoundedRectangleRect(self, Rect r, double radius) | |
DrawSpline(self, List points) | |
DrawText(self, String text, int x, int y) | |
Draw a list of strings using a list of coordinants for positioning each string. | |
DrawTextPoint(self, String text, Point pt) | |
EndDoc(self) | |
EndDrawing(self) | |
EndPage(self) | |
FloodFill(self, int x, int y, Colour col, int style=FLOOD_SURFACE) -> bool | |
FloodFillPoint(self, Point pt, Colour col, int style=FLOOD_SURFACE) -> bool | |
GetBackground(self) -> Brush | |
GetBackgroundMode(self) -> int | |
GetBoundingBox() -> (x1,y1, x2,y2) | |
GetBrush(self) -> Brush | |
GetCharHeight(self) -> int | |
GetCharWidth(self) -> int | |
GetClippingBox() -> (x, y, width, height) | |
GetClippingRect(self) -> Rect | |
GetDepth(self) -> int | |
GetDeviceOrigin(self) -> Point | |
GetDeviceOriginTuple() -> (x,y) | |
GetFont(self) -> Font | |
GetFullTextExtent(wxString string, Font font=None) -> (width, height, descent, externalLeading) Get the width, height, decent and leading of the text using the current or specified font. | |
GetLogicalFunction(self) -> int | |
GetLogicalOrigin(self) -> Point | |
GetLogicalOriginTuple() -> (x,y) | |
GetLogicalScale() -> (xScale, yScale) | |
GetMapMode(self) -> int | |
GetMultiLineTextExtent(wxString string, Font font=None) -> (width, height, descent, externalLeading) Get the width, height, decent and leading of the text using the current or specified font. | |
<function GetOptimization at 0xb6ad6d4c> is deprecated | |
GetPartialTextExtents(self, text) -> [widths] | |
GetPen(self) -> Pen | |
GetPixel(self, int x, int y) -> Colour | |
GetPixelPoint(self, Point pt) -> Colour | |
GetPPI(self) -> Size | |
GetSize(self) -> Size | |
GetSizeMM(self) -> Size | |
GetSizeMMTuple() -> (width, height) | |
GetSizeTuple() -> (width, height) | |
GetTextBackground(self) -> Colour | |
GetTextExtent(wxString string) -> (width, height) | |
GetTextForeground(self) -> Colour | |
GetUserScale(self) -> (xScale, yScale) | |
LogicalToDeviceX(self, int x) -> int | |
LogicalToDeviceXRel(self, int x) -> int | |
LogicalToDeviceY(self, int y) -> int | |
LogicalToDeviceYRel(self, int y) -> int | |
MaxX(self) -> int | |
MaxY(self) -> int | |
MinX(self) -> int | |
MinY(self) -> int | |
Ok(self) -> bool | |
ResetBoundingBox(self) | |
SetAxisOrientation(self, bool xLeftRight, bool yBottomUp) | |
SetBackground(self, Brush brush) | |
SetBackgroundMode(self, int mode) | |
SetBrush(self, Brush brush) | |
SetClippingRect(self, Rect rect) | |
SetClippingRegion(self, int x, int y, int width, int height) | |
SetClippingRegionAsRegion(self, Region region) | |
SetClippingRegionPointSize(self, Point pt, Size sz) | |
SetDeviceOrigin(self, int x, int y) | |
SetDeviceOriginPoint(self, Point point) | |
SetFont(self, Font font) | |
SetLogicalFunction(self, int function) Sets the current logical function for the device context. | |
SetLogicalOrigin(self, int x, int y) | |
SetLogicalOriginPoint(self, Point point) | |
SetLogicalScale(self, double x, double y) | |
SetMapMode(self, int mode) The *mapping mode* of the device context defines the unit of measurement used to convert logical units to device units. | |
<function SetOptimization at 0xb6ad6d14> is deprecated | |
SetPalette(self, Palette palette) | |
SetPen(self, Pen pen) | |
SetTextBackground(self, Colour colour) | |
SetTextForeground(self, Colour colour) | |
SetUserScale(self, double x, double y) | |
StartDoc(self, String message) -> bool | |
StartPage(self) | |
Inherited from Object | |
Destroy(self) | |
GetClassName(self) -> String | |
Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
helper for pickle | |
helper for pickle | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) |
Method Details |
---|
__del__(self,
destroy=<built-in function delete_DC>)
__del__(self)
|
_DrawEllipseList(*args, **kwargs)_DrawEllipseList(self, PyObject pyCoords, PyObject pyPens, PyObject pyBrushes) -> PyObject |
_DrawLineList(*args, **kwargs)_DrawLineList(self, PyObject pyCoords, PyObject pyPens, PyObject pyBrushes) -> PyObject |
_DrawPointList(*args, **kwargs)_DrawPointList(self, PyObject pyCoords, PyObject pyPens, PyObject pyBrushes) -> PyObject |
_DrawPolygonList(*args, **kwargs)_DrawPolygonList(self, PyObject pyCoords, PyObject pyPens, PyObject pyBrushes) -> PyObject |
_DrawRectangleList(*args, **kwargs)_DrawRectangleList(self, PyObject pyCoords, PyObject pyPens, PyObject pyBrushes) -> PyObject |
_DrawTextList(*args, **kwargs)_DrawTextList(self, PyObject textList, PyObject pyPoints, PyObject foregroundList, PyObject backgroundList) -> PyObject |
BeginDrawing(*args, **kwargs)BeginDrawing(self) Allows for optimization of drawing code on platforms that need it. On other platforms this is just an empty function and is harmless. To take advantage of this postential optimization simply enclose each group of calls to the drawing primitives within calls to `BeginDrawing` and `EndDrawing`. |
Blit(*args, **kwargs)Blit(self, int xdest, int ydest, int width, int height, DC source, int xsrc, int ysrc, int rop=COPY, bool useMask=False, int xsrcMask=-1, int ysrcMask=-1) -> bool 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. |
BlitPointSize(*args, **kwargs)BlitPointSize(self, Point destPt, Size sz, DC source, Point srcPt, int rop=COPY, bool useMask=False, Point srcPtMask=DefaultPosition) -> bool 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. |
CalcBoundingBox(*args, **kwargs)CalcBoundingBox(self, int x, int y) Adds the specified point to the bounding box which can be retrieved with `MinX`, `MaxX` and `MinY`, `MaxY` or `GetBoundingBox` functions. |
CalcBoundingBoxPoint(*args, **kwargs)CalcBoundingBoxPoint(self, Point point) Adds the specified point to the bounding box which can be retrieved with `MinX`, `MaxX` and `MinY`, `MaxY` or `GetBoundingBox` functions. |
CanDrawBitmap(*args, **kwargs)CanDrawBitmap(self) -> bool |
CanGetTextExtent(*args, **kwargs)CanGetTextExtent(self) -> bool |
Clear(*args, **kwargs)Clear(self) Clears the device context using the current background brush. |
ComputeScaleAndOrigin(*args, **kwargs)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(*args, **kwargs)CrossHair(self, int x, int 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. |
CrossHairPoint(*args, **kwargs)CrossHairPoint(self, Point 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. |
DestroyClippingRegion(*args, **kwargs)DestroyClippingRegion(self) Destroys the current clipping region so that none of the DC is clipped. |
DeviceToLogicalX(*args, **kwargs)DeviceToLogicalX(self, int x) -> int Convert device X coordinate to logical coordinate, using the current mapping mode. |
DeviceToLogicalXRel(*args, **kwargs)DeviceToLogicalXRel(self, int x) -> int 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. |
DeviceToLogicalY(*args, **kwargs)DeviceToLogicalY(self, int y) -> int Converts device Y coordinate to logical coordinate, using the current mapping mode. |
DeviceToLogicalYRel(*args, **kwargs)DeviceToLogicalYRel(self, int y) -> int 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. |
DrawArc(*args, **kwargs)DrawArc(self, int x1, int y1, int x2, int y2, int xc, int 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. |
DrawArcPoint(*args, **kwargs)DrawArcPoint(self, Point pt1, Point pt2, Point 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. |
DrawBitmap(*args, **kwargs)DrawBitmap(self, Bitmap bmp, int x, int y, bool 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. |
DrawBitmapPoint(*args, **kwargs)DrawBitmapPoint(self, Bitmap bmp, Point pt, bool 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. |
DrawCheckMark(*args, **kwargs)DrawCheckMark(self, int x, int y, int width, int height) Draws a check mark inside the given rectangle. |
DrawCheckMarkRect(*args, **kwargs)DrawCheckMarkRect(self, Rect rect) Draws a check mark inside the given rectangle. |
DrawCircle(*args, **kwargs)DrawCircle(self, int x, int y, int 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. |
DrawCirclePoint(*args, **kwargs)DrawCirclePoint(self, Point pt, int 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. |
DrawEllipse(*args, **kwargs)DrawEllipse(self, int x, int y, int width, int 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. |
DrawEllipseList(self, ellipses, pens=None, brushes=None)Draw a list of ellipses as quickly as possible. :param ellipses: A sequence of 4-element sequences representing each ellipse to draw, (x,y, w,h). :param 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. :param brushes: A brush or brushes to be used to fill the ellipses, with similar semantics as the pens parameter. |
DrawEllipsePointSize(*args, **kwargs)DrawEllipsePointSize(self, Point pt, Size 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. |
DrawEllipseRect(*args, **kwargs)DrawEllipseRect(self, Rect 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. |
DrawEllipticArc(*args, **kwargs)DrawEllipticArc(self, int x, int y, int w, int h, double start, double 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. |
DrawEllipticArcPointSize(*args, **kwargs)DrawEllipticArcPointSize(self, Point pt, Size sz, double start, double 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. |
DrawIcon(*args, **kwargs)DrawIcon(self, Icon icon, int x, int 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. |
DrawIconPoint(*args, **kwargs)DrawIconPoint(self, Icon icon, Point 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. |
DrawImageLabel(*args, **kwargs)DrawImageLabel(self, String text, Bitmap image, Rect rect, int alignment=wxALIGN_LEFT|wxALIGN_TOP, int indexAccel=-1) -> Rect 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. |
DrawLabel(*args, **kwargs)DrawLabel(self, String text, Rect rect, int alignment=wxALIGN_LEFT|wxALIGN_TOP, int 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. |
DrawLine(*args, **kwargs)DrawLine(self, int x1, int y1, int x2, int 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). |
DrawLineList(self, lines, pens=None)Draw a list of lines as quickly as possible. :param lines: A sequence of 4-element sequences representing each line to draw, (x1,y1, x2,y2). :param 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(*args, **kwargs)DrawLinePoint(self, Point pt1, Point 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). |
DrawLines(*args, **kwargs)DrawLines(self, List points, int xoffset=0, int 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. |
DrawPoint(*args, **kwargs)DrawPoint(self, int x, int y) Draws a point using the current pen. |
DrawPointList(self, points, pens=None)Draw a list of points as quickly as possible. :param points: A sequence of 2-element sequences representing each point to draw, (x,y). :param 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(*args, **kwargs)DrawPointPoint(self, Point pt) Draws a point using the current pen. |
DrawPolygon(*args, **kwargs)DrawPolygon(self, List points, int xoffset=0, int yoffset=0, int 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. |
DrawPolygonList(self, polygons, pens=None, brushes=None)Draw a list of polygons, each of which is a list of points. :param polygons: A sequence of sequences of sequences. [[(x1,y1),(x2,y2),(x3,y3)...], [(x1,y1),(x2,y2),(x3,y3)...]] :param 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. :param brushes: A brush or brushes to be used to fill the polygons, with similar semantics as the pens parameter. |
DrawRectangle(*args, **kwargs)DrawRectangle(self, int x, int y, int width, int 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. |
DrawRectangleList(self, rectangles, pens=None, brushes=None)Draw a list of rectangles as quickly as possible. :param rectangles: A sequence of 4-element sequences representing each rectangle to draw, (x,y, w,h). :param 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. :param brushes: A brush or brushes to be used to fill the rectagles, with similar semantics as the pens parameter. |
DrawRectanglePointSize(*args, **kwargs)DrawRectanglePointSize(self, Point pt, Size 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. |
DrawRectangleRect(*args, **kwargs)DrawRectangleRect(self, Rect 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. |
DrawRotatedText(*args, **kwargs)DrawRotatedText(self, String text, int x, int y, double 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. |
DrawRotatedTextPoint(*args, **kwargs)DrawRotatedTextPoint(self, String text, Point pt, double 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. |
DrawRoundedRectangle(*args, **kwargs)DrawRoundedRectangle(self, int x, int y, int width, int height, double 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. |
DrawRoundedRectanglePointSize(*args, **kwargs)DrawRoundedRectanglePointSize(self, Point pt, Size sz, double 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. |
DrawRoundedRectangleRect(*args, **kwargs)DrawRoundedRectangleRect(self, Rect r, double 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. |
DrawSpline(*args, **kwargs)DrawSpline(self, List 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'. |
DrawText(*args, **kwargs)DrawText(self, String text, int x, int 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. |
DrawTextList(self, textList, coords, foregrounds=None, backgrounds=None)Draw a list of strings using a list of coordinants for positioning each string. :param textList: A list of strings :param coords: A list of (x,y) positions :param foregrounds: A list of `wx.Colour` objects to use for the foregrounds of the strings. :param backgrounds: A list of `wx.Colour` objects to use for the backgrounds of the strings. NOTE: Make sure you set Background mode to wx.Solid (DC.SetBackgroundMode) If you want backgrounds to do anything. |
DrawTextPoint(*args, **kwargs)DrawTextPoint(self, String text, Point 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. |
EndDoc(*args, **kwargs)EndDoc(self) Ends a document (only relevant when outputting to a printer). |
EndDrawing(*args, **kwargs)EndDrawing(self) Ends the group of drawing primitives started with `BeginDrawing`, and invokes whatever optimization is available for this DC type on the current platform. |
EndPage(*args, **kwargs)EndPage(self) Ends a document page (only relevant when outputting to a printer). |
FloodFill(*args, **kwargs)FloodFill(self, int x, int y, Colour col, int style=FLOOD_SURFACE) -> bool Flood fills the device context starting from the given point, using the current brush colour, and using a style:
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. |
FloodFillPoint(*args, **kwargs)FloodFillPoint(self, Point pt, Colour col, int style=FLOOD_SURFACE) -> bool Flood fills the device context starting from the given point, using the current brush colour, and using a style:
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. |
GetBackground(*args, **kwargs)GetBackground(self) -> Brush Gets the brush used for painting the background. |
GetBackgroundMode(*args, **kwargs)GetBackgroundMode(self) -> int Returns the current background mode, either ``wx.SOLID`` or ``wx.TRANSPARENT``. |
GetBoundingBox(*args, **kwargs)GetBoundingBox() -> (x1,y1, x2,y2) Returns the min and max points used in drawing commands so far. |
GetBrush(*args, **kwargs)GetBrush(self) -> Brush Gets the current brush |
GetCharHeight(*args, **kwargs)GetCharHeight(self) -> int Gets the character height of the currently set font. |
GetCharWidth(*args, **kwargs)GetCharWidth(self) -> int Gets the average character width of the currently set font. |
GetClippingBox(*args, **kwargs)GetClippingBox() -> (x, y, width, height) Gets the rectangle surrounding the current clipping region. |
GetClippingRect(*args, **kwargs)GetClippingRect(self) -> Rect Gets the rectangle surrounding the current clipping region. |
GetDepth(*args, **kwargs)GetDepth(self) -> int Returns the colour depth of the DC. |
GetDeviceOrigin(*args, **kwargs)GetDeviceOrigin(self) -> Point |
GetDeviceOriginTuple(*args, **kwargs)GetDeviceOriginTuple() -> (x,y) |
GetFont(*args, **kwargs)GetFont(self) -> Font Gets the current font |
GetFullTextExtent(*args, **kwargs)GetFullTextExtent(wxString string, Font font=None) -> (width, height, descent, externalLeading) Get the width, height, decent and leading of the text using the current or specified font. Only works for single line strings. |
GetLogicalFunction(*args, **kwargs)GetLogicalFunction(self) -> int Gets the current logical function (set by `SetLogicalFunction`). |
GetLogicalOrigin(*args, **kwargs)GetLogicalOrigin(self) -> Point |
GetLogicalOriginTuple(*args, **kwargs)GetLogicalOriginTuple() -> (x,y) |
GetLogicalScale(*args, **kwargs)GetLogicalScale() -> (xScale, yScale) |
GetMapMode(*args, **kwargs)GetMapMode(self) -> int Gets the current *mapping mode* for the device context |
GetMultiLineTextExtent(*args, **kwargs)GetMultiLineTextExtent(wxString string, Font font=None) -> (width, height, descent, externalLeading) Get the width, height, decent and leading of the text using the current or specified font. Works for single as well as multi-line strings. |
GetOptimization(*args, **kwargs)<function GetOptimization at 0xb6ad6d4c> is deprecated |
GetPartialTextExtents(*args, **kwargs)GetPartialTextExtents(self, text) -> [widths] 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. |
GetPen(*args, **kwargs)GetPen(self) -> Pen Gets the current pen |
GetPixel(*args, **kwargs)GetPixel(self, int x, int y) -> Colour Gets the colour at the specified location on the DC. |
GetPixelPoint(*args, **kwargs)GetPixelPoint(self, Point pt) -> Colour |
GetPPI(*args, **kwargs)GetPPI(self) -> Size Resolution in Pixels per inch |
GetSize(*args, **kwargs)GetSize(self) -> Size 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)) |
GetSizeMM(*args, **kwargs)GetSizeMM(self) -> Size Get the DC size in milimeters. |
GetSizeMMTuple(*args, **kwargs)GetSizeMMTuple() -> (width, height) Get the DC size in milimeters. |
GetSizeTuple(*args, **kwargs)GetSizeTuple() -> (width, height) 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)) |
GetTextBackground(*args, **kwargs)GetTextBackground(self) -> Colour Gets the current text background colour |
GetTextExtent(*args, **kwargs)GetTextExtent(wxString string) -> (width, height) Get the width and height of the text using the current font. Only works for single line strings. |
GetTextForeground(*args, **kwargs)GetTextForeground(self) -> Colour Gets the current text foreground colour |
GetUserScale(*args, **kwargs)GetUserScale(self) -> (xScale, yScale) Gets the current user scale factor (set by `SetUserScale`). |
LogicalToDeviceX(*args, **kwargs)LogicalToDeviceX(self, int x) -> int Converts logical X coordinate to device coordinate, using the current mapping mode. |
LogicalToDeviceXRel(*args, **kwargs)LogicalToDeviceXRel(self, int x) -> int 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. |
LogicalToDeviceY(*args, **kwargs)LogicalToDeviceY(self, int y) -> int Converts logical Y coordinate to device coordinate, using the current mapping mode. |
LogicalToDeviceYRel(*args, **kwargs)LogicalToDeviceYRel(self, int y) -> int 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. |
MaxX(*args, **kwargs)MaxX(self) -> int Gets the maximum horizontal extent used in drawing commands so far. |
MaxY(*args, **kwargs)MaxY(self) -> int Gets the maximum vertical extent used in drawing commands so far. |
MinX(*args, **kwargs)MinX(self) -> int Gets the minimum horizontal extent used in drawing commands so far. |
MinY(*args, **kwargs)MinY(self) -> int Gets the minimum vertical extent used in drawing commands so far. |
Ok(*args, **kwargs)Ok(self) -> bool Returns true if the DC is ok to use. |
ResetBoundingBox(*args, **kwargs)ResetBoundingBox(self) Resets the bounding box: after a call to this function, the bounding box doesn't contain anything. |
SetAxisOrientation(*args, **kwargs)SetAxisOrientation(self, bool xLeftRight, bool 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. |
SetBackground(*args, **kwargs)SetBackground(self, Brush brush) Sets the current background brush for the DC. |
SetBackgroundMode(*args, **kwargs)SetBackgroundMode(self, int 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. |
SetBrush(*args, **kwargs)SetBrush(self, Brush 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. |
SetClippingRect(*args, **kwargs)SetClippingRect(self, Rect 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. |
SetClippingRegion(*args, **kwargs)SetClippingRegion(self, int x, int y, int width, int 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. |
SetClippingRegionAsRegion(*args, **kwargs)SetClippingRegionAsRegion(self, Region 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. |
SetClippingRegionPointSize(*args, **kwargs)SetClippingRegionPointSize(self, Point pt, Size 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. |
SetDeviceOrigin(*args, **kwargs)SetDeviceOrigin(self, int x, int y) |
SetDeviceOriginPoint(*args, **kwargs)SetDeviceOriginPoint(self, Point point) |
SetFont(*args, **kwargs)SetFont(self, Font 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. |
SetLogicalFunction(*args, **kwargs)SetLogicalFunction(self, int 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. |
SetLogicalOrigin(*args, **kwargs)SetLogicalOrigin(self, int x, int y) |
SetLogicalOriginPoint(*args, **kwargs)SetLogicalOriginPoint(self, Point point) |
SetLogicalScale(*args, **kwargs)SetLogicalScale(self, double x, double y) |
SetMapMode(*args, **kwargs)SetMapMode(self, int 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. ================ ============================================= |
SetOptimization(*args, **kwargs)<function SetOptimization at 0xb6ad6d14> is deprecated |
SetPalette(*args, **kwargs)SetPalette(self, Palette 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. |
SetPen(*args, **kwargs)SetPen(self, Pen 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. |
SetTextBackground(*args, **kwargs)SetTextBackground(self, Colour colour) Sets the current text background colour for the DC. |
SetTextForeground(*args, **kwargs)SetTextForeground(self, Colour colour) Sets the current text foreground colour for the DC. |
SetUserScale(*args, **kwargs)SetUserScale(self, double x, double y) Sets the user scaling factor, useful for applications which require 'zooming'. |
StartDoc(*args, **kwargs)StartDoc(self, String message) -> bool Starts a document (only relevant when outputting to a printer). *Message* is a message to show whilst printing. |
StartPage(*args, **kwargs)StartPage(self) Starts a document page (only relevant when outputting to a printer). |
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Sun Feb 4 18:01:15 2007 | http://epydoc.sf.net |