]> git.saurik.com Git - wxWidgets.git/blame - wxPython/tests/blit.py
don't do anything in SetBackgroundColour() if colour is invalid
[wxWidgets.git] / wxPython / tests / blit.py
CommitLineData
f17fee68
RD
1#-------------------------------------------------
2
3from wxPython.wx import *
4
5
6class MyFrame(wxFrame):
7 def __init__(self,parent,title,id):
8 wxFrame.__init__(self,parent,title,id,
9 wxPoint(100,100),wxSize(300,300))
10
11
12 self.SetBackgroundColour(wxWHITE)
13 self.windowx,self.windowy=self.GetClientSizeTuple()
14
15 # make a memory DC to draw into...
16 self.mask=wxMemoryDC()
17
18 self.maskbitmap=wxEmptyBitmap(self.windowx,self.windowy)
19 self.mask.SelectObject(self.maskbitmap)
20 self.mask.SetBackgroundMode(wxTRANSPARENT)
21
22 self.mask.SetDeviceOrigin(0,0)
23
24 self.mask.SetBrush(wxBrush(wxColour(150,160,0),wxSOLID))
25 self.mask.SetPen(wxPen(wxColour(1,2,3),1,wxSOLID))
26 self.mask.DrawRectangle(0,0,self.windowx,self.windowy)
27
28 img = wxImageFromBitmap(self.maskbitmap)
29 print (img.GetRed(0,0), img.GetGreen(0,0), img.GetBlue(0,0))
30
31
32 def OnPaint(self,evt):
33 """ overriding OnPaint to give handler. """
34 dc = wxPaintDC(self)
35
36 dc.Blit(0,0,self.windowx,self.windowy,self.mask,0,0,wxCOPY)
37
38#-----------------------------------------------------------
39
40if __name__ == "__main__":
41 class MyApp(wxApp):
42 def OnInit(self):
43
44 self.frame = MyFrame(NULL, -1, "Blit Test")
45 self.frame.Show(true)
46
47 self.exiting = FALSE;
48 return true
49
50 app = MyApp(0) # Create an instance of the application
51 app.MainLoop() # Tell it to start processing events
52
53
54