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/import wxclass Brush(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.SetBrush(wx.Brush('#4c4c4c', wx.CROSS_HATCH))dc.DrawRectangle(10, 15, 90, 60)dc.SetBrush(wx.Brush('#4c4c4c', wx.SOLID))dc.DrawRectangle(130, 15, 90, 60)dc.SetBrush(wx.Brush('#4c4c4c', wx.BDIAGONAL_HATCH))dc.DrawRectangle(250, 15, 90, 60)dc.SetBrush(wx.Brush('#4c4c4c', wx.CROSSDIAG_HATCH))dc.DrawRectangle(10, 105, 90, 60)dc.SetBrush(wx.Brush('#4c4c4c', wx.FDIAGONAL_HATCH))dc.DrawRectangle(130, 105, 90, 60)dc.SetBrush(wx.Brush('#4c4c4c', wx.HORIZONTAL_HATCH))dc.DrawRectangle(250, 105, 90, 60)dc.SetBrush(wx.Brush('#4c4c4c', wx.VERTICAL_HATCH))dc.DrawRectangle(10, 195, 90, 60)dc.SetBrush(wx.Brush('#4c4c4c', wx.TRANSPARENT))dc.DrawRectangle(130, 195, 90, 60)app = wx.App()Brush(None, -1, 'Brushes')app.MainLoop()15 de 44 27/04/2008 1:08

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

Saved successfully!

Ooh no, something went wrong!