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: LinesClippingClipping is restricting drawing to a certain area. Clipping isused in two cases. To create effects and to improveperformance of the application. We restrict drawing to acertain region with the SetClippingRegionAsRegion() method.In the following example we will modify and enhance ourprevious script.#!/usr/bin/python# star.pyimport wxfrom math import hypot, sin, cos, piclass Star(wx.Frame):def __init__(self, parent, id, title):wx.Frame.__init__(self, parent, id, title, size=(350, 300))self.Bind(wx.EVT_PAINT, self.OnPaint)self.Centre()27 de 44 27/04/2008 1:08

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

Saved successfully!

Ooh no, something went wrong!