test drawing rectangles with wxGCDC
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@44673 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
44
wxPython/tests/test_gcdcDrawRect.py
Normal file
44
wxPython/tests/test_gcdcDrawRect.py
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
import wx
|
||||
|
||||
CLIP = True
|
||||
|
||||
class TestPanel(wx.Panel):
|
||||
def __init__(self, parent, *args):
|
||||
wx.Panel.__init__(self, parent, *args)
|
||||
self.Bind(wx.EVT_PAINT, self.OnPaint)
|
||||
|
||||
def OnPaint(self, evt):
|
||||
pdc = wx.PaintDC(self)
|
||||
gcdc = wx.GCDC(pdc)
|
||||
|
||||
for dc, y in [(gcdc, 10), (pdc, 40)]:
|
||||
r = wx.Rect(10, y, 100, 20)
|
||||
|
||||
dc.SetPen(wx.Pen("red", 1))
|
||||
dc.SetBrush(wx.Brush("light blue"))
|
||||
|
||||
if CLIP: dc.SetClippingRect(r)
|
||||
dc.DrawRectangleRect(r)
|
||||
dc.DestroyClippingRegion()
|
||||
|
||||
r.Offset((120, 0))
|
||||
if CLIP: dc.SetClippingRect(r)
|
||||
dc.DrawRoundedRectangleRect(r, 8)
|
||||
dc.DestroyClippingRegion()
|
||||
|
||||
|
||||
r.Offset((120, 0))
|
||||
if CLIP: dc.SetClippingRect(r)
|
||||
dc.DrawEllipseRect(r)
|
||||
dc.DestroyClippingRegion()
|
||||
|
||||
|
||||
app = wx.App(False)
|
||||
frm = wx.Frame(None, title="wxGCDC Drawing Rectangles")
|
||||
pnl = TestPanel(frm)
|
||||
frm.Show()
|
||||
app.MainLoop()
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user