wx.GraphicsPenInfo¶
This class is a helper used for wx.GraphicsPen creation using the named parameter idiom: it allows specifying various wx.GraphicsPen attributes using the chained calls to its clearly named methods instead of passing them in the fixed order to wx.GraphicsPen constructors.
Typically, you would use wx.GraphicsPenInfo with a wx.GraphicsContext. For example, to start drawing with a dotted blue pen slightly wider than normal you could, write the following:
ctx = wx.GraphicsContext.Create(dc)
pen = ctx.CreatePen(wx.GraphicsPenInfo(wx.BLUE).Width(1.25).Style(wx.PENSTYLE_DOT))
ctx.SetPen(pen)
Added in version 4.1/wxWidgets-3.1.1.
Class Hierarchy¶
Methods Summary¶
Constructor, which can set the colour, width and style for the pen. |
|
Sets the cap (i.e., the end point) for the pen. |
|
Sets the colour for the pen. |
|
Returns the pen’s cap (i.e., end-point style). |
|
Returns the pen’s colour. |
|
Returns the x coordinate of the ending point (if using a gradient). |
|
Returns the y coordinate of the ending point (if using a gradient). |
|
Returns the pen’s gradient type. |
|
Returns the pen’s joining method. |
|
Returns the radius of the radial gradient. |
|
Returns the x coordinate of the starting point (if using a gradient). |
|
Returns the y coordinate of the starting point (if using a gradient). |
|
Returns the pen’s stipple bitmap. |
|
Returns the stops of the gradient. |
|
Returns the pen’s style. |
|
Returns the pen’s line width. |
|
Returns the x coordinate of the starting point (if using a gradient). |
|
Returns the x coordinate of the ending point (if using a gradient). |
|
Returns the y coordinate of the starting point (if using a gradient). |
|
Returns the y coordinate of the ending point (if using a gradient). |
|
Returns whether the pen is transparent. |
|
Sets the join for the pen, which is the appearance of where two lines meet or overlap. |
|
Applies a linear gradient to the pen. |
|
Applies a radial (i.e., circular) gradient to the pen. |
|
Sets the bitmap used for stippling. |
|
Sets the style for the pen. |
|
Sets the line width for the pen. |
Properties Summary¶
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
Class API¶
- class wx.GraphicsPenInfo(object)¶
Possible constructors:
GraphicsPenInfo(colour=Colour(), width=1.0, style=PENSTYLE_SOLID) -> None
This class is a helper used for GraphicsPen creation using the named parameter idiom: it allows specifying various GraphicsPen attributes using the chained calls to its clearly named methods instead of passing them in the fixed order to GraphicsPen constructors.
Methods¶
- __init__(self, colour=Colour(), width=1.0, style=PENSTYLE_SOLID)¶
Constructor, which can set the colour, width and style for the pen.
- Cap(self, cap)¶
Sets the cap (i.e., the end point) for the pen.
- Parameters:
cap (PenCap)
- Return type:
- GetEndX(self)¶
Returns the x coordinate of the ending point (if using a gradient).
- Return type:
float
- GetEndY(self)¶
Returns the y coordinate of the ending point (if using a gradient).
- Return type:
float
- GetGradientType(self)¶
Returns the pen’s gradient type.
- Return type:
- GetJoin(self)¶
Returns the pen’s joining method.
- Return type:
- GetRadius(self)¶
Returns the radius of the radial gradient.
- Return type:
float
- GetStartX(self)¶
Returns the x coordinate of the starting point (if using a gradient).
- Return type:
float
- GetStartY(self)¶
Returns the y coordinate of the starting point (if using a gradient).
- Return type:
float
- GetStops(self)¶
Returns the stops of the gradient.
- Return type:
- GetStyle(self)¶
Returns the pen’s style.
- Return type:
- GetWidth(self)¶
Returns the pen’s line width.
- Return type:
float
- GetX1(self)¶
Returns the x coordinate of the starting point (if using a gradient).
- Return type:
float
- GetX2(self)¶
Returns the x coordinate of the ending point (if using a gradient).
- Return type:
float
- GetY1(self)¶
Returns the y coordinate of the starting point (if using a gradient).
- Return type:
float
- GetY2(self)¶
Returns the y coordinate of the ending point (if using a gradient).
- Return type:
float
- IsTransparent(self)¶
Returns whether the pen is transparent.
- Return type:
bool
- Join(self, join)¶
Sets the join for the pen, which is the appearance of where two lines meet or overlap.
- Parameters:
join (PenJoin)
- Return type:
- LinearGradient(self, *args, **kw)¶
-
LinearGradient (self, x1, y1, x2, y2, c1, c2, matrix=NullGraphicsMatrix)
Applies a linear gradient to the pen.
- Parameters:
x1 (wx.Double) – The x coordinate of the starting point of the gradient.
y1 (wx.Double) – The y coordinate of the starting point of the gradient.
x2 (wx.Double) – The x coordinate of the ending point of the gradient.
y2 (wx.Double) – The y coordinate of the ending point of the gradient.
c1 (wx.Colour) – The starting colour.
c2 (wx.Colour) – The ending colour.
matrix (wx.GraphicsMatrix) – An optional transformation to apply to the gradient.
- Return type:
Note
The starting and ending coordinates define the direction of the gradient. Along with north, south, east and west, diagonal directions can also be used.
LinearGradient (self, x1, y1, x2, y2, stops, matrix=NullGraphicsMatrix)
Applies a linear gradient to the pen, including discontinuous stops in the pattern.
- Parameters:
x1 (wx.Double) – The x coordinate of the starting point of the gradient.
y1 (wx.Double) – The y coordinate of the starting point of the gradient.
x2 (wx.Double) – The x coordinate of the ending point of the gradient.
y2 (wx.Double) – The y coordinate of the ending point of the gradient.
stops (wx.GraphicsGradientStops) – A series of stops to include in the pattern.
matrix (wx.GraphicsMatrix) – An optional transformation to apply to the gradient.
- Return type:
Note
The starting and ending coordinates define the direction of the gradient. Along with north, south, east and west, diagonal directions can also be used.
- RadialGradient(self, *args, **kw)¶
-
RadialGradient (self, startX, startY, endX, endY, radius, oColor, cColor, matrix=NullGraphicsMatrix)
Applies a radial (i.e., circular) gradient to the pen.
- Parameters:
startX (wx.Double) – The x coordinate of the starting point of the gradient.
startY (wx.Double) – The startY coordinate of the starting point of the gradient.
endX (wx.Double) – The endX coordinate of the end of the circle.
endY (wx.Double) – The endY coordinate of the end of the circle.
radius (wx.Double) – The radius of the circle of the gradient (around endX and endY).
oColor (wx.Colour) – The outer colour.
cColor (wx.Colour) – The center colour.
matrix (wx.GraphicsMatrix) – An optional transformation to apply to the gradient.
- Return type:
Note
The starting and ending coordinates define the direction of the gradient. Along with north, south, east and west, diagonal directions can also be used.
RadialGradient (self, startX, startY, endX, endY, radius, stops, matrix=NullGraphicsMatrix)
Applies a radial (i.e., circular) gradient to the pen, including discontinuous stops in the pattern.
- Parameters:
startX (wx.Double) – The x coordinate of the starting point of the gradient.
startY (wx.Double) – The startY coordinate of the starting point of the gradient.
endX (wx.Double) – The endX coordinate of the end of the circle.
endY (wx.Double) – The endY coordinate of the end of the circle.
radius (wx.Double) – The radius of the circle of the gradient (around endX and endY).
stops (wx.GraphicsGradientStops) – A series of stops to include in the pattern.
matrix (wx.GraphicsMatrix) – An optional transformation to apply to the gradient.
- Return type:
Note
The starting and ending coordinates define the direction of the gradient. Along with north, south, east and west, diagonal directions can also be used.
- Stipple(self, stipple)¶
Sets the bitmap used for stippling.
When the pen is used, a repeating pattern of this bitmap will be drawn.
- Parameters:
stipple (wx.Bitmap)
- Return type:
- Width(self, width)¶
Sets the line width for the pen.
- Parameters:
width (wx.Double)
- Return type:
Properties¶
- GradientType¶
See
GetGradientType
