.. wxPython Phoenix documentation This file was generated by Phoenix's sphinx generator and associated tools, do not edit by hand. Copyright: (c) 2011-2017 by Total Control Software License: wxWindows License .. include:: headings.inc .. currentmodule:: wx.lib.graphics .. highlight:: python .. _wx.lib.graphics.GraphicsPen: ========================================================================================================================================== |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 :class:`wx.Pen`, and a :class:`wx.Pen` can be used to initialize a ``GraphicsPen`` using the :meth:`GraphicsPen.CreateFromPen` staticmethod. | |class_hierarchy| Class Hierarchy ================================= .. raw:: html
Inheritance diagram for class GraphicsPen:

| |super_classes| Known Superclasses ================================== :class:`wx.lib.graphics.GraphicsObject` | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.lib.graphics.GraphicsPen.__init__` Create a new ``GraphicsPen`` :meth:`~wx.lib.graphics.GraphicsPen.Apply` Apply this pen's properties to the given context. :meth:`~wx.lib.graphics.GraphicsPen.CreateFromPattern` Create a ``GraphicsPen`` directly from a Cairo Pattern object. :meth:`~wx.lib.graphics.GraphicsPen.CreateFromPen` Convert a :class:`wx.Pen` to a ``GraphicsPen`` ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~wx.lib.graphics.GraphicsPen.Cap` The style of the end cap used when drawing with the pen. :attr:`~wx.lib.graphics.GraphicsPen.Colour` The color associated with this pen, to be used when drawing the line. :attr:`~wx.lib.graphics.GraphicsPen.Dashes` Dashes is a sequence of values defining the size of line segments and blanks :attr:`~wx.lib.graphics.GraphicsPen.Join` The pen's join style, used when drawing connected lines. :attr:`~wx.lib.graphics.GraphicsPen.Pattern` A pattern to be used when drawing a line with the pen. :attr:`~wx.lib.graphics.GraphicsPen.Stipple` Stipple is a bitmap to use as a pattern when drawing a line with the pen. :attr:`~wx.lib.graphics.GraphicsPen.Style` Defines the type of pen, including things like solid, dashed, stipple, etc. :attr:`~wx.lib.graphics.GraphicsPen.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 :class:`wx.Pen`, and a :class:`wx.Pen` can be used to initialize a ``GraphicsPen`` using the :meth:`GraphicsPen.CreateFromPen` staticmethod. .. method:: __init__(self, colour=wx.BLACK, width=1, style=wx.SOLID) Create a new ``GraphicsPen`` .. method:: Apply(self, ctx) Apply this pen's properties to the given context. Called by :class:`GraphicsContext` as needed. .. staticmethod:: 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. .. staticmethod:: CreateFromPen(pen) Convert a :class:`wx.Pen` to a ``GraphicsPen`` .. attribute:: Cap The style of the end cap used when drawing with the pen. :type: :ref:`wx.PenCap` .. attribute:: Colour The color associated with this pen, to be used when drawing the line. :type: :class:`wx.Colour` .. attribute:: Dashes Dashes is a sequence of values defining the size of line segments and blanks to use when drawing a line. .. attribute:: Join The pen's join style, used when drawing connected lines. The default is ``wx.JOIN_ROUND``. :type: :ref:`wx.PenJoin` .. attribute:: Pattern A pattern to be used when drawing a line with the pen. :type: Cairo ``Pattern`` .. attribute:: 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 :class:`GraphicsContext`. :type: :class:`wx.Bitmap` .. attribute:: Style Defines the type of pen, including things like solid, dashed, stipple, etc. :type: :ref:`wx.PenStyle` .. attribute:: Width The width of the line to be drawn with this pen. :type: int or float