13.07.2015 Views

The wxPython tutorial

The wxPython tutorial

The wxPython tutorial

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>The</strong> Graphics Device Interfacehttp://www.zetcode.com/wxpython/gdi/Figure: StarOperations over RegionsRegions can be combined to create more complex shapes. Wecan use four set operations. Union, Intersect, Substract andXor.<strong>The</strong> following example shows all four operations in action.#!/usr/bin/python# operations.pyimport wxclass Operations(wx.Frame):def __init__(self, parent, id, title):wx.Frame.__init__(self, parent, id, title, size=(270, 220))self.Bind(wx.EVT_PAINT, self.OnPaint)self.Centre()self.Show(True)def OnPaint(self, event):dc = wx.PaintDC(self)dc.SetPen(wx.Pen('#d4d4d4'))dc.DrawRectangle(20, 20, 50, 50)dc.DrawRectangle(30, 40, 50, 50)dc.SetBrush(wx.Brush('#ffffff'))29 de 44 27/04/2008 1:08

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

Saved successfully!

Ooh no, something went wrong!