Phoenix Logo

phoenix_title wx.lib.graphics.GraphicsPen

A GraphicsPen is used to define the properties of how a stroke is drawn.

The properties and features of this class are similar to wx.Pen, and a wx.Pen can be used to initialize a GraphicsPen using the GraphicsPen.CreateFromPen staticmethod.


class_hierarchy Class Hierarchy

Inheritance diagram for class GraphicsPen:

method_summary Methods Summary

__init__ Create a new GraphicsPen
Apply Apply this pen’s properties to the given context.
CreateFromPattern Create a GraphicsPen directly from a Cairo Pattern object.
CreateFromPen Convert a wx.Pen to a GraphicsPen

property_summary Properties Summary

Cap The style of the end cap used when drawing with the pen.
Colour The color associated with this pen, to be used when drawing the line.
Dashes Dashes is a sequence of values defining the size of line segments and blanks
Join The pen’s join style, used when drawing connected lines.
Pattern A pattern to be used when drawing a line with the pen.
Stipple Stipple is a bitmap to use as a pattern when drawing a line with the pen.
Style Defines the type of pen, including things like solid, dashed, stipple, etc.
Width The width of the line to be drawn with this pen.

api Class API



class GraphicsPen(GraphicsObject)

A GraphicsPen is used to define the properties of how a stroke is drawn.

The properties and features of this class are similar to wx.Pen, and a wx.Pen can be used to initialize a GraphicsPen using the GraphicsPen.CreateFromPen staticmethod.


Methods



__init__(self, colour=wx.BLACK, width=1, style=wx.SOLID)

Create a new GraphicsPen



Apply(self, ctx)

Apply this pen’s properties to the given context. Called by GraphicsContext as needed.



static CreateFromPattern(pattern, width=1)

Create a GraphicsPen directly from a Cairo Pattern object. This is similar to using a stipple bitmap, but saves a step, and patterns can include gradients, etc.



static CreateFromPen(pen)

Convert a wx.Pen to a GraphicsPen


Properties



Cap

The style of the end cap used when drawing with the pen.

Type: wx.PenCap


Colour

The color associated with this pen, to be used when drawing the line.

Type:wx.Colour


Dashes

Dashes is a sequence of values defining the size of line segments and blanks to use when drawing a line.



Join

The pen’s join style, used when drawing connected lines.

The default is wx.JOIN_ROUND.

Type: wx.PenJoin


Pattern

A pattern to be used when drawing a line with the pen.

Type:Cairo Pattern


Stipple

Stipple is a bitmap to use as a pattern when drawing a line with the pen.

This will be converted to a Cairo Pattern when applied to a GraphicsContext.

Type:wx.Bitmap


Style

Defines the type of pen, including things like solid, dashed, stipple, etc.

Type: wx.PenStyle


Width

The width of the line to be drawn with this pen.

Type:int or float