| 3 | |
| 4 | class PFBitmapFrame(wx.Frame): |
| 5 | def __init__(self, parent, pos, bitmap): |
| 6 | super().__init__( |
| 7 | parent, id=wx.ID_ANY, title=wx.EmptyString, pos=pos, size=wx.DefaultSize, |
| 8 | style=wx.NO_BORDER | wx.FRAME_NO_TASKBAR | wx.STAY_ON_TOP) |
| 9 | img = bitmap.ConvertToImage() |
| 10 | img = img.ConvertToGreyscale() |
| 11 | bitmap = wx.Bitmap(img) |
| 12 | self.bitmap = bitmap |
| 13 | self.SetSize((bitmap.GetWidth(), bitmap.GetHeight())) |
| 14 | self.Bind(wx.EVT_PAINT, self.OnWindowPaint) |
| 15 | self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnWindowEraseBk) |
| 16 | self.Bind(wx.EVT_TIMER, self.OnTimer) |
| 17 | |
| 18 | self.timer = wx.Timer(self, wx.ID_ANY) |
| 19 | self.direction = 1 |
| 20 | self.transp = 0 |
| 21 | self.SetSize((bitmap.GetWidth(), bitmap.GetHeight())) |
| 22 | |
| 23 | self.SetBackgroundStyle(wx.BG_STYLE_PAINT) |
| 24 | |
| 25 | self.SetTransparent(0) |
| 26 | self.Refresh() |
| 27 | |
| 28 | def OnTimer(self, event): |
| 29 | self.transp += 20 * self.direction |