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/Figure: BrushesCustom PatternsWe are not restricted to use predefined patterns. We caneasily create our own custom patterns.wx.Brush BrushFromBitmap(wx.Bitmap stippleBitmap)This method creates a custom brush from the bitmap.#!/usr/bin/python# custompatterns.pyimport wxclass CustomPatterns(wx.Frame):def __init__(self, parent, id, title):wx.Frame.__init__(self, parent, id, title, size=(350, 280))self.Bind(wx.EVT_PAINT, self.OnPaint)self.Centre()self.Show(True)def OnPaint(self, event):dc = wx.PaintDC(self)dc.SetPen(wx.Pen('#C7C3C3'))brush1 = wx.BrushFromBitmap(wx.Bitmap('pattern1.png'))16 de 44 27/04/2008 1:08

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

Saved successfully!

Ooh no, something went wrong!