]> git.saurik.com Git - wxWidgets.git/blob - wxPython/tests/test_gcMemDC.py
declare GetGDKWindow() in wxDC to fix compilation of wxRendererNative
[wxWidgets.git] / wxPython / tests / test_gcMemDC.py
1 """
2 Tests using a memory dc (or a buffered dc) as the target of a
3 wx.GraphicsContext.
4 """
5
6 import wx
7 #import os; print "PID:", os.getpid(); raw_input("Press Enter...")
8
9
10 class TestPanel(wx.Panel):
11 def __init__(self, *args, **kw):
12 wx.Panel.__init__(self, *args, **kw)
13 self.Bind(wx.EVT_PAINT, self.OnPaint)
14 self.Bind(wx.EVT_SIZE, self.OnSize)
15
16 def OnSize(self, evt):
17 self.Refresh()
18
19 def OnPaint(self, evt):
20 #dc = wx.PaintDC(self)
21 dc = wx.BufferedPaintDC(self)
22 gcdc = wx.GCDC(dc)
23
24 sz = self.GetSize()
25 gcdc.SetBackground(wx.Brush(self.GetBackgroundColour()))
26 gcdc.Clear()
27 gcdc.DrawLine(0, 0, sz.width, sz.height)
28 gcdc.DrawLine(sz.width, 0, 0, sz.height)
29
30
31 app = wx.App(False)
32 frm = wx.Frame(None, title="GC/MemoryDC")
33 pnl = TestPanel(frm)
34 frm.Show()
35 app.MainLoop()