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/def OnPaint(self, event):dc = wx.PaintDC(self)dc.DrawCheckMark(100, 50, 30, 40)app = wx.App()CheckMark(None, -1, 'Check Mark')app.MainLoop()Figure: Check MarkS H A P E SShapes are more sophisticated geometrical objects. We willdraw various geometrical shapes in the following example.#!/usr/bin/python# shapes.pyimport wxclass Shapes(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()self.Show(True)def OnPaint(self, event):dc = wx.PaintDC(self)dc.DrawEllipse(20, 20, 90, 60)dc.DrawRoundedRectangle(130, 20, 90, 60, 10)dc.DrawArc(240, 40, 340, 40, 290, 20)23 de 44 27/04/2008 1:08

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

Saved successfully!

Ooh no, something went wrong!