13.07.2015 Views

The wxPython tutorial

The wxPython tutorial

The wxPython tutorial

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>The</strong> Graphics Device Interfacehttp://www.zetcode.com/wxpython/gdi/dc.DrawRectangle(10, 105, 90, 60)dc.SetPen(wx.Pen('#4c4c4c', 1, wx.DOT_DASH))dc.DrawRectangle(130, 105, 90, 60)dc.SetPen(wx.Pen('#4c4c4c', 1, wx.TRANSPARENT))dc.DrawRectangle(250, 105, 90, 60)app = wx.App()Pens(None, -1, 'Pens')app.MainLoop()If we don't specify a custom brush, a default one is used. <strong>The</strong>default brush is wx.WHITE_BRUSH. <strong>The</strong> perimeter of therectangles is drawn by the pen. <strong>The</strong> last one has no border. Itis transparent, e.g. not visible.Figure: PensJoins and CapsA pen object has additional two parameters. <strong>The</strong> Join and theCap. <strong>The</strong> Join defines how joins between lines will be drawn.<strong>The</strong> Join style has the following options:wx.JOIN_MITERwx.JOIN_BEVELwx.JOIN_ROUNDWhen using wx.JOIN_MITER the outer edges of the lines areextended. <strong>The</strong>y meet at an angle, and this area is filled. Inwx.JOIN_BEVEL the triangular notch between two lines isfilled. In wx.JOIN_ROUND the circular arc between the twolines is filled. <strong>The</strong> default value is wx.JOIN_ROUND.<strong>The</strong> Cap defines how the line ends will be drawn by the pen.10 de 44 27/04/2008 1:08

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!