| 1 | import wx |
| 2 | |
| 3 | ##import os; print os.getpid(); raw_input("press enter...") |
| 4 | |
| 5 | |
| 6 | class TestPanel(wx.Panel): |
| 7 | def __init__(self, parent): |
| 8 | wx.Panel.__init__(self, parent) |
| 9 | self.Bind(wx.EVT_PAINT, self.OnPaint) |
| 10 | |
| 11 | def OnPaint(self, evt): |
| 12 | dc = wx.GCDC(wx.PaintDC(self)) |
| 13 | #dc = wx.PaintDC(self) |
| 14 | r = wx.Rect(64, 25, 45, 18) |
| 15 | dc.SetPen(wx.Pen("black", 1)) |
| 16 | dc.SetBrush(wx.Brush("red")) |
| 17 | dc.DrawRectangleRect(r) |
| 18 | |
| 19 | dc.SetPen(wx.TRANSPARENT_PEN) |
| 20 | #dc.SetPen(wx.Pen("light blue", 1)) |
| 21 | dc.SetBrush(wx.Brush("light blue")) |
| 22 | dc.DrawRectangle(r.x+1, r.y+1, r.width-2, r.height-2) |
| 23 | |
| 24 | dc.SetPen(wx.Pen("black", 1)) |
| 25 | dc.DrawLine(r.x+r.width+02, r.y, |
| 26 | r.x+r.width+15, r.y) |
| 27 | dc.DrawLine(r.x+r.width+02, r.y+r.height-1, |
| 28 | r.x+r.width+15, r.y+r.height-1) |
| 29 | |
| 30 | |
| 31 | app = wx.App(False) |
| 32 | frm = wx.Frame(None) |
| 33 | pnl = TestPanel(frm) |
| 34 | frm.Show() |
| 35 | app.MainLoop() |