]> git.saurik.com Git - wxWidgets.git/blob - wxPython/tests/test_gcdcDrawRect.py
wx.lib.flatnotebook: Patch from Andrea that implements the following:
[wxWidgets.git] / wxPython / tests / test_gcdcDrawRect.py
1
2 import wx
3
4 CLIP = True
5
6 class TestPanel(wx.Panel):
7 def __init__(self, parent, *args):
8 wx.Panel.__init__(self, parent, *args)
9 self.Bind(wx.EVT_PAINT, self.OnPaint)
10
11 def OnPaint(self, evt):
12 pdc = wx.PaintDC(self)
13 gcdc = wx.GCDC(pdc)
14
15 for dc, y in [(gcdc, 10), (pdc, 40)]:
16 r = wx.Rect(10, y, 100, 20)
17
18 dc.SetPen(wx.Pen("red", 1))
19 dc.SetBrush(wx.Brush("light blue"))
20
21 if CLIP: dc.SetClippingRect(r)
22 dc.DrawRectangleRect(r)
23 dc.DestroyClippingRegion()
24
25 r.Offset((120, 0))
26 if CLIP: dc.SetClippingRect(r)
27 dc.DrawRoundedRectangleRect(r, 8)
28 dc.DestroyClippingRegion()
29
30
31 r.Offset((120, 0))
32 if CLIP: dc.SetClippingRect(r)
33 dc.DrawEllipseRect(r)
34 dc.DestroyClippingRegion()
35
36
37 app = wx.App(False)
38 frm = wx.Frame(None, title="wxGCDC Drawing Rectangles")
39 pnl = TestPanel(frm)
40 frm.Show()
41 app.MainLoop()
42
43
44