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.DrawPolygon(((130, 140), (180, 170), (180, 140), (220, 110), (140, 1dc.DrawRectangle(20, 120, 80, 50)dc.DrawSpline(((240, 170), (280, 170), (285, 110), (325, 110)))dc.DrawLines(((20, 260), (100, 260), (20, 210), (100, 210)))dc.DrawCircle(170, 230, 35)dc.DrawRectangle(250, 200, 60, 60)app = wx.App()Shapes(None, -1, 'Shapes')app.MainLoop()In our example we have drawn an ellipse, a roundedrectangle, an arc, a rectangle ,a polygon, splines, lines, acircle and a square (from right to left, from top to bottom). Acircle is a special kind of ellipse and a square is a special kindof rectangle.Figure: ShapesR E G I O N S<strong>The</strong> device context can be divided into several parts calledRegions. A region can be of any shape. A region can be asimple rectangle or circle. With Union, Intersect, Substractand Xor operations we can create complex regions fromsimple ones. Regions are used for outlining, filling or clipping.24 de 44 27/04/2008 1:08

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

Saved successfully!

Ooh no, something went wrong!