]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/wxPIA_book/Chapter-08/shaped_frame.py
4 class ShapedFrame(wx
.Frame
):
6 wx
.Frame
.__init
__(self
, None, -1, "Shaped Window",
7 style
= wx
.FRAME_SHAPED | wx
.SIMPLE_BORDER |
10 self
.bmp
= images
.getVippiBitmap()
11 self
.SetClientSize((self
.bmp
.GetWidth(), self
.bmp
.GetHeight()))
12 dc
= wx
.ClientDC(self
)
13 dc
.DrawBitmap(self
.bmp
, 0,0, True)
15 self
.Bind(wx
.EVT_LEFT_DCLICK
, self
.OnDoubleClick
)
16 self
.Bind(wx
.EVT_RIGHT_UP
, self
.OnExit
)
17 self
.Bind(wx
.EVT_PAINT
, self
.OnPaint
)
18 self
.Bind(wx
.EVT_WINDOW_CREATE
, self
.SetWindowShape
)
20 def SetWindowShape(self
, evt
=None):
21 r
= wx
.RegionFromBitmap(self
.bmp
)
22 self
.hasShape
= self
.SetShape(r
)
24 def OnDoubleClick(self
, evt
):
26 self
.SetShape(wx
.Region())
31 def OnPaint(self
, evt
):
33 dc
.DrawBitmap(self
.bmp
, 0,0, True)
35 def OnExit(self
, evt
):
38 if __name__
== '__main__':
39 app
= wx
.PySimpleApp()