def SetWindowTransparencies(self, opacity=100): if self.transparencyMode == 0: # Partial window (overall) transparency self.SetTransparent(opacity * 255 / 100) # Bitmap transparency enabled (cn't see background) self.bmap = self.bmap_convertedAlpha self.SetShape(wx.RegionFromBitmap(self.bmap)) elif self.transparencyMode == 1: # No window transparency (what bitmaps mask shows is 100% opaque) self.SetTransparent(255) # Bitmap transparency enabled self.bmap = self.bmap_convertedAlpha self.SetShape(wx.RegionFromBitmap(self.bmap)) elif self.transparencyMode == 2: # No window transparency (what is seen is 100% opaque) self.SetTransparent(255) # Bitmap transparency mask is disabled self.bmap = self.bmap_unconvertedAplha self.SetShape(wx.Region()) self.transparencyMode += 1 if self.transparencyMode > 2: self.transparencyMode = 0
def InitTabRegions(self): self.tabRegion = wx.RegionFromBitmap(self.tabBackBitmap) self.closeBtnRegion = wx.RegionFromBitmap(self.ctabCloseBmp) self.closeBtnRegion.Offset( self.contentWidth + self.leftWidth - self.ctabCloseBmp.GetWidth() / 2, (self.tabHeight - self.ctabCloseBmp.GetHeight()) / 2)
def InitTabRegions(self): """ Initializes regions for tab, which makes it easier to determine if given coordinates are incluced in a region """ self.tabRegion = wx.RegionFromBitmap(self.tabBackBitmap) self.closeBtnRegion = wx.RegionFromBitmap(self.ctabCloseBmp) self.closeBtnRegion.Offset(self.contentWidth + self.leftWidth - self.ctabCloseBmp.GetWidth()/2, (self.tabHeight - self.ctabCloseBmp.GetHeight())/2)
def __init__(self, parent, img, parent_bitmap, action, x=0, y=0): self.parent = parent self.set_images(img) my_region = wx.RegionFromBitmap(self.img) self.region = wx.RegionFromBitmap(parent_bitmap) self.region.IntersectRegion(my_region) self.action = action self.x = 0 self.y = 0 self.move_to(x, y) self.press_level = 'none' self.set_press_level('off')
def draw_region_stretch(self, img_string, dest_x, dest_y, dest_w, dest_h): # print "draw_region_stretch", "img_string", img_string, "x:", dest_x, "y:", dest_y, "w:",dest_w, "h:",dest_h ''' draws a stretched region @param img_string: the key to a bitmap in the cache @param dest_x: x coordinate to draw at, relative to the origin of the rectangle for this image @param dest_y: y coordinate to draw at, relative to the origin of the rectangle for this image @param dest_w: width to draw this section of the image @param dest_h: height to draw this section of the image ''' if dest_w > 0 and dest_h > 0: myimg = self.cache[img_string] if img_string + 's' not in self.cache or \ self.cache[img_string + 's'].GetWidth() != dest_w or \ self.cache[img_string + 's'].GetHeight() != dest_h: temp = myimg.ConvertToImage() temp.Rescale(dest_w, dest_h) self.cache[img_string + 's'] = wx.BitmapFromImage(temp) self.cache[img_string + 'sr'] = wx.RegionFromBitmap( self.cache[img_string + 's']) if not self.cache[img_string + 'sr'].IsEmpty(): self.cache[img_string + 'sr'].Offset( self.rect.x + dest_x, self.rect.y + dest_y) self.dc.DrawBitmap(self.cache[img_string + 's'], self.rect.x + dest_x, self.rect.y + dest_y, True) #r for region self.rs.append(self.cache[img_string + 'sr'])
def __init__(self, parent, title, app, input, output): wx.Frame.__init__(self, parent, title=title, size=(900, 680), style=wx.FRAME_SHAPED | wx.NO_FULL_REPAINT_ON_RESIZE | wx.CLIP_CHILDREN) self.SetDoubleBuffered(True) # Things like the XButton need access to the app, so that they can tell the app to exit self.panel = LauncherPanel(self) self.panel.app = app # output is how we send stuff to the launcher self.panel.output = output # input is how the launcher sends stuff to us self.panel.input = input self.Centre() shape = Background.Alpha.GetBitmap() shape.SetMask(wx.Mask(shape, wx.WHITE)) self.SetShape(wx.RegionFromBitmap(shape)) self.Show()
def OnCreate(self): global frame global bmp reg = wx.RegionFromBitmap(bmp) frame.SetShape(reg) print(frame) return
def GetClickRegion(self, bitmap): """ build the clickable region, use mask if available, else black as transparent color """ if bitmap.GetMask(): region = wx.RegionFromBitmap(bitmap) else: region = wx.RegionFromBitmapColour(bitmap, wx.Color(0, 0, 0, 0)) return region
def draw_region_static(self, img_string, dest_x, dest_y, dest_w, dest_h): ''' draws a tiled region. alignment, offset, and background color are pulled from the cache @param img_string: the key to a bitmap in the cache @param dest_x: x coordinate to draw at, relative to the origin of the rectangle for this image @param dest_y: y coordinate to draw at, relative to the origin of the rectangle for this image @param dest_w: width to draw this section of the image @param dest_h: height to draw this section of the image ''' if dest_w > 0 and dest_h > 0: myimg = self.cache[img_string] halign = self.cache[img_string + "ch"] valign = self.cache[img_string + "cv"] offset = self.cache[img_string + "co"] if halign == 'left': x = 0 elif halign == 'right': x = dest_w - myimg.GetWidth() else: x = dest_w / 2 - myimg.GetWidth() / 2 x = x + dest_x + self.rect.x + offset[0] if valign == 'top': y = 0 elif valign == 'bottom': y = dest_h - myimg.GetHeight() else: y = dest_h / 2 - myimg.GetHeight() / 2 y = y + dest_y + self.rect.y + offset[1] self.dc.SetClippingRegion(self.rect.x + dest_x, self.rect.y + dest_y, dest_w, dest_h) #c for statiC if img_string + "cb" in self.cache and self.cache[ img_string + "cb"] is not None: self.dc.SetBrush(self.cache[img_string + "cb"]) self.dc.SetPen(wx.TRANSPARENT_PEN) self.dc.DrawRectangle(self.rect.x + dest_x, self.rect.y + dest_y, dest_w, dest_h) self.dc.SetPen(wx.NullPen) self.dc.SetBrush(wx.NullBrush) self.dc.DrawBitmap(myimg, x, y, True) #r for region if img_string + "r" not in self.cache: new = (wx.RegionFromBitmap(myimg), x, y) self.cache[img_string + "r"] = new if not new[0].IsEmpty(): new[0].Offset(x, y) else: old, oldx, oldy = self.cache[img_string + "r"] if not old.IsEmpty(): old.Offset(x - oldx, y - oldy) self.cache[img_string + "r"] = (old, x, y) self.rs.append(self.cache[img_string + "r"][0]) self.dc.DestroyClippingRegion()
def SetWindowShape(self, evt=None, hotspot=None): # Use the bitmap's mask to determine the region rgn = wx.RegionFromBitmap(self.bmp) if hotspot is not None: # punch a hole in the region at the hotspot to allow mouse events # through to the window below rect = wx.Rect(hotspot.x-1, hotspot.y-1, 3, 3) rgn.SubtractRect(rect) self.SetShape(rgn)
def create_shape(self): """ Creates a shaped window """ # Sets the window position and size self.SetPosition((self.frame_pos[0], self.frame_pos[1])) self.SetClientSize(tuple(self.frame_size)) # Sets a new shape dc = wx.ClientDC(self) dc.DrawBitmap(self.message_bitmap, 0, 0, True) self.SetShape(wx.RegionFromBitmap(self.message_bitmap)) return None
def __init__(self, parent, title): wx.Frame.__init__(self, parent, title=title, size=(900, 680), style= wx.FRAME_SHAPED | wx.NO_FULL_REPAINT_ON_RESIZE | wx.CLIP_CHILDREN) self.SetDoubleBuffered(True) self.panel = LauncherPanel(self) self.Centre() shape = Background.Alpha.GetBitmap() shape.SetMask(wx.Mask(shape, wx.WHITE)) self.SetShape(wx.RegionFromBitmap(shape)) self.Show()
def rounded_rectangle_region(width, height, radius): """ Returns a rounded rectangle wx.Region """ bmp = wx.EmptyBitmapRGBA(width, height) # Mask color is #000000 dc = wx.MemoryDC(bmp) dc.Brush = wx.Brush((255, ) * 3) # Any non-black would do dc.DrawRoundedRectangle(0, 0, width, height, radius) dc.SelectObject(wx.NullBitmap) bmp.SetMaskColour((0, ) * 3) return wx.RegionFromBitmap(bmp)
def SetWindowShape(self, *event): # Use the bitmap's mask to determine the region if PHOENIX: r = wx.Region(self.bmp, transColour=wx.Colour(255, 255, 255, 0), tolerance=0) else: self.bmp mask = wx.Mask(self.bmp, wx.Colour(255, 255, 255, 0)) self.bmp.SetMask(mask) r = wx.RegionFromBitmap(self.bmp) self.hasShape = self.SetShape(r)
def InitializeToSize(self, width, height): b = wx.EmptyBitmap(width, height) dc = wx.MemoryDC() dc.SelectObject(b) dc.SetBackground(wx.Brush('black')) dc.Clear() dc.SetBrush(wx.TRANSPARENT_BRUSH) dc.SetPen(wx.Pen('red', 4)) dc.DrawRectangle(10, 10, width - 20, height - 20) dc.SelectObject(wx.NullBitmap) b.SetMaskColour('black') self.SetShape(wx.RegionFromBitmap(b)) self.SetBackgroundColour('red') self.Show(True)
def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, style=wx.FRAME_SHAPED | wx.SIMPLE_BORDER | wx.FRAME_NO_TASKBAR) self.font = wx.Font(11, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, 'Comic Sans MS') self.bitmap = wx.Bitmap('note.png', wx.BITMAP_TYPE_PNG) self.cross = wx.Bitmap('cross.png', wx.BITMAP_TYPE_PNG) w = self.bitmap.GetWidth() h = self.bitmap.GetHeight() self.SetClientSize((w, h)) if wx.Platform == '__WXGTK__': self.Bind(wx.EVT_WINDOW_CREATE, self.SetNoteShape) else: self.SetNoteShape() self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown) self.Bind(wx.EVT_MOTION, self.OnMouseMove) self.bitmapRegion = wx.RegionFromBitmap(self.bitmap) self.crossRegion = wx.RegionFromBitmap(self.cross) self.bitmapRegion.IntersectRegion(self.crossRegion) self.bitmapRegion.Offset(170, 10) dc = wx.ClientDC(self) dc.DrawBitmap(self.bitmap, 0, 0, True) self.PositionTopRight() self.Show(True)
def get_polyregion(points, w, h, border=1): i = wx.EmptyImage(w + border, h + border) b = i.WXB m = wx.MemoryDC(b) m.Clear() m.SetBrush(wx.Brush(wx.Color(0,0,0))) m.SetPen(wx.Pen(wx.Color(0,0,0))) #ceil(border/2)? m.DrawRectangle(0,0,w + border, h + border) m.SetBrush(wx.Brush(wx.Color(255,255,255))) m.SetPen(wx.Pen(wx.Color(255,255,255))) m.DrawPolygon(points) m.SelectObject(wx.NullBitmap) del m b.SetMaskColour(wx.Color(0,0,0)) return wx.RegionFromBitmap(b)
def GetPolyRegion(points, w, h, border=1): i = wx.EmptyImage(w + border, h + border) b = wx.BitmapFromImage(i) m = wx.MemoryDC(b) m.Clear() m.SetBrush(wx.BLACK_BRUSH) m.SetPen(wx.BLACK_PEN) m.DrawRectangle(0, 0, w + border, h + border) m.SetBrush(wx.WHITE_BRUSH) m.SetPen(wx.Pen(wx.WHITE)) m.DrawPolygon(points) m.SelectObject(wx.NullBitmap) b.SetMask(wx.Mask(b, wx.BLACK)) return wx.RegionFromBitmap(b)
def set_shape(self): dc = wx.MemoryDC() bmp = wx.EmptyBitmap(*self.Size) dc.SelectObject(bmp) dc.Background = wx.WHITE_BRUSH dc.Clear() dc.Brush = wx.BLACK_BRUSH factor = 3 dc.DrawRoundedRectangle(0, 0, self.Size[0]-factor, self.Size[1]-factor, radius) del dc img = wx.ImageFromBitmap(bmp) img.SetMaskColour(255,255,255) bmp = wx.BitmapFromImage(img) self.SetShape(wx.RegionFromBitmap(bmp))
def __init__(self): """Constructor""" image_sideA = wx.Bitmap(cassette_files[0]) image_sideB = wx.Bitmap(cassette_files[1]) self.bmp = image_sideA windowWidth = image_sideA.GetWidth() windowHeight = image_sideA.GetHeight() wx.Frame.__init__(self, None, size=(windowWidth,windowHeight),style=wx.FRAME_SHAPED) panel = MainPanel(self, [image_sideA, image_sideB]) r = wx.RegionFromBitmap(self.bmp) self.SetShape(r) self.Show() self.Center() # The paint stuff is only necessary if doing a shaped window self.Bind(wx.EVT_PAINT, self.OnPaint)
def SetWindowShape(self, bbmp): r = wx.RegionFromBitmap(bbmp) self.hasShape = self.SetShape(r) if wx.Platform != "__WXMAC__": # wxMac clips the tooltip to the window shape, YUCK!!! self.SetToolTipString( "Right-click to close the window\n" "Double-click the image to set/unset the window shape") if wx.Platform == "__WXGTK__": # wxGTK requires that the window be created before you can # set its shape, so delay the call to SetWindowShape until # this event. #self.Bind(wx.EVT_WINDOW_CREATE, self.SetWindowShape) print "hai mei xie wang!" else: # On wxMSW and wxMac the window has already been created, so go for it. # Use the bitmap's mask to determine the region self.dc = wx.ClientDC(self) #bbmp.SetMaskColour(wx.BLUE) self.dc.DrawBitmap(bbmp, 0, 0, True)
def __init__(self): timeout = 2000 # A smaller number then the first timeout mainframetimeout = 500 wx.Frame.__init__( self, None, -1, "", wx.DefaultPosition, wx.DefaultSize, wx.FRAME_NO_TASKBAR | wx.FRAME_SHAPED | wx.STAY_ON_TOP) # Load the FP logo img = wx.Image(os.path.join(fpsys.mythingsdir, 'splash.png')) img.ConvertAlphaToMask() self.bmp = wx.BitmapFromImage(img) # Calculate the shape self.reg = wx.RegionFromBitmap(self.bmp) # Works on wx.Platform == "__WXGTK__" self.Bind(wx.EVT_WINDOW_CREATE, self.SetSplashShape) w = self.bmp.GetWidth() + 1 h = self.bmp.GetHeight() + 1 # Set frame to the bitmap size self.SetClientSize((w, h)) self.CenterOnScreen() # Starts timer self._splashtimer = wx.PyTimer(self.OnNotify) self._splashtimer.Start(timeout) self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) # Nice! Kick the MainFrame off in x milliseconds self.fc = wx.FutureCall(mainframetimeout, self.showMain) self.Show()
def ShowOSD( self, osdText="", fontInfo=None, textColour=(255, 255, 255), outlineColour=(0, 0, 0), alignment=0, offset=(0, 0), displayNumber=0, timeout=3.0, event=None, skin=None, ): self.timer.cancel() if osdText.strip() == "": self.bitmap = wx.EmptyBitmap(0, 0) SetWindowPos(self.hwnd, 0, 0, 0, 0, 0, HWND_FLAGS | SWP_HIDEWINDOW) SetEvent(event) return #self.Freeze() memoryDC = wx.MemoryDC() # make sure the mask colour is not used by foreground or # background colour forbiddenColours = (textColour, outlineColour) maskColour = (255, 0, 255) if maskColour in forbiddenColours: maskColour = (0, 0, 2) if maskColour in forbiddenColours: maskColour = (0, 0, 3) maskBrush = wx.Brush(maskColour, wx.SOLID) memoryDC.SetBackground(maskBrush) if fontInfo is None: fontInfo = DEFAULT_FONT_INFO font = wx.FontFromNativeInfoString(fontInfo) memoryDC.SetFont(font) textLines = osdText.splitlines() sizes = [memoryDC.GetTextExtent(line or " ") for line in textLines] textWidths, textHeights = zip(*sizes) textWidth = max(textWidths) textHeight = sum(textHeights) if skin: bitmap = self.GetSkinnedBitmap(textLines, textWidths, textHeights, textWidth, textHeight, memoryDC, textColour, "Default") width, height = bitmap.GetSize() elif outlineColour is None: width, height = textWidth, textHeight bitmap = wx.EmptyBitmap(width, height) memoryDC.SelectObject(bitmap) # fill the DC background with the maskColour memoryDC.Clear() # draw the text with the foreground colour memoryDC.SetTextForeground(textColour) DrawTextLines(memoryDC, textLines, textHeights) # mask the bitmap, so we can use it to get the needed # region of the window memoryDC.SelectObject(wx.NullBitmap) bitmap.SetMask(wx.Mask(bitmap, maskColour)) # fill the anti-aliased pixels of the text with the foreground # colour, because the region of the window will add these # half filled pixels also. Otherwise we would get an ugly # border with mask-coloured pixels. memoryDC.SetBackground(wx.Brush(textColour, wx.SOLID)) memoryDC.SelectObject(bitmap) memoryDC.Clear() memoryDC.SelectObject(wx.NullBitmap) else: width, height = textWidth + 5, textHeight + 5 outlineBitmap = wx.EmptyBitmap(width, height, 1) outlineDC = wx.MemoryDC() outlineDC.SetFont(font) outlineDC.SelectObject(outlineBitmap) outlineDC.Clear() outlineDC.SetBackgroundMode(wx.SOLID) DrawTextLines(outlineDC, textLines, textHeights) outlineDC.SelectObject(wx.NullBitmap) outlineBitmap.SetMask(wx.Mask(outlineBitmap)) outlineDC.SelectObject(outlineBitmap) bitmap = wx.EmptyBitmap(width, height) memoryDC.SetTextForeground(outlineColour) memoryDC.SelectObject(bitmap) memoryDC.Clear() Blit = memoryDC.Blit logicalFunc = wx.COPY for x in xrange(5): for y in xrange(5): Blit(x, y, width, height, outlineDC, 0, 0, logicalFunc, True) outlineDC.SelectObject(wx.NullBitmap) memoryDC.SetTextForeground(textColour) DrawTextLines(memoryDC, textLines, textHeights, 2, 2) memoryDC.SelectObject(wx.NullBitmap) bitmap.SetMask(wx.Mask(bitmap, maskColour)) region = wx.RegionFromBitmap(bitmap) self.SetShape(region) self.bitmap = bitmap monitorDimensions = GetMonitorDimensions() try: displayRect = monitorDimensions[displayNumber] except IndexError: displayRect = monitorDimensions[0] xOffset, yOffset = offset xFunc, yFunc = ALIGNMENT_FUNCS[alignment] x = displayRect.x + xFunc((displayRect.width - width), xOffset) y = displayRect.y + yFunc((displayRect.height - height), yOffset) deviceContext = wx.ClientDC(self) deviceContext.DrawBitmap(self.bitmap, 0, 0, False) SetWindowPos(self.hwnd, 0, x, y, width, height, HWND_FLAGS | SWP_SHOWWINDOW) if timeout > 0.0: self.timer = threading.Timer(timeout, self.OnTimeout) self.timer.start() eg.app.Yield(True) SetEvent(event)
def OnClick(self, evt): bmp = wx.Image('vippi.png').ConvertToBitmap() r = wx.RegionFromBitmap(bmp) self.SetShape(r)
def SetWindowShape(self, *evt): # Use the bitmap's mask to determine the region r = wx.RegionFromBitmap(self.bmp) self.hasShape = self.SetShape(r)
def SetWindowShape(self, evt=None): r = wx.RegionFromBitmap(self.bmp) self.hasShape = self.SetShape(r)
def OnCreate(self, event): """on create""" self.SetShape(wx.RegionFromBitmap(self.message_bitmap)) return None
def GetRoundShape( w, h, r ): return wx.RegionFromBitmap(GetRoundBitmap(w,h,r))
def CreateRegion(self): region = wx.RegionFromBitmap(self.tbmp) return region
def __init__(self, parent, id=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.FRAME_NO_TASKBAR | wx.FRAME_SHAPED | wx.STAY_ON_TOP, bitmap=None, timeout=5000, agwStyle=AS_TIMEOUT | AS_CENTER_ON_SCREEN, shadowcolour=wx.NullColour): """ Default class constructor. :param `bitmap`: this must be a valid `wx.Bitmap`, that you may construct using whatever image file format supported by wxPython. If the file you load already supports mask/transparency (like png), the transparent areas will not be drawn on screen, and the L{AdvancedSplash} frame will have the shape defined only by *non-transparent* pixels. If you use other file formats that does not supports transparency, you can obtain the same effect as above by masking a specific colour in your `wx.Bitmap`. :param `timeout`: if you construct L{AdvancedSplash} using the style ``AS_TIMEOUT``, L{AdvancedSplash} will be destroyed after `timeout` milliseconds; :param `agwStyle`: this value specifies the L{AdvancedSplash} styles: ======================= =========== ================================================== Window Styles Hex Value Description ======================= =========== ================================================== ``AS_TIMEOUT`` 0x1 L{AdvancedSplash} will be destroyed after `timeout` milliseconds. ``AS_NOTIMEOUT`` 0x2 L{AdvancedSplash} can be destroyed by clicking on it, pressing a key or by explicitly call the `Close()` method. ``AS_CENTER_ON_SCREEN`` 0x4 L{AdvancedSplash} will be centered on screen. ``AS_CENTER_ON_PARENT`` 0x8 L{AdvancedSplash} will be centered on parent. ``AS_NO_CENTER`` 0x10 L{AdvancedSplash} will not be centered. ``AS_SHADOW_BITMAP`` 0x20 If the bitmap you pass as input has no transparency, you can choose one colour that will be masked in your bitmap. the final shape of L{AdvancedSplash} will be defined only by non-transparent (non-masked) pixels. ======================= =========== ================================================== :param `shadowcolour`: if you construct L{AdvancedSplash} using the style ``AS_SHADOW_BITMAP``, here you can specify the colour that will be masked on your input bitmap. This has to be a valid wxPython colour. """ wx.Frame.__init__(self, parent, id, "", pos, size, style) # Some Error Checking if agwStyle & AS_TIMEOUT and timeout <= 0: raise Exception('\nERROR: Style "AS_TIMEOUT" Used With Invalid "timeout" Parameter Value (' \ + str(timeout) + ')') if agwStyle & AS_SHADOW_BITMAP and not shadowcolour.IsOk(): raise Exception( '\nERROR: Style "AS_SHADOW_BITMAP" Used With Invalid "shadowcolour" Parameter' ) if not bitmap or not bitmap.IsOk(): raise Exception( "\nERROR: Bitmap Passed To AdvancedSplash Is Invalid.") if agwStyle & AS_SHADOW_BITMAP: # Our Bitmap Is Masked Accordingly To User Input self.bmp = self.ShadowBitmap(bitmap, shadowcolour) else: self.bmp = bitmap self._agwStyle = agwStyle # Setting Initial Properties self.SetText() self.SetTextFont() self.SetTextPosition() self.SetTextColour() # Calculate The Shape Of AdvancedSplash Using The Input-Modified Bitmap self.reg = wx.RegionFromBitmap(self.bmp) # Don't Know If It Works On Other Platforms!! # Tested Only In Windows XP/2000 if wx.Platform == "__WXGTK__": self.Bind(wx.EVT_WINDOW_CREATE, self.SetSplashShape) else: self.SetSplashShape() w = self.bmp.GetWidth() h = self.bmp.GetHeight() # Set The AdvancedSplash Size To The Bitmap Size self.SetSize((w, h)) if agwStyle & AS_CENTER_ON_SCREEN: self.CenterOnScreen() elif agwStyle & AS_CENTER_ON_PARENT: self.CenterOnParent() if agwStyle & AS_TIMEOUT: # Starts The Timer. Once Expired, AdvancedSplash Is Destroyed self._splashtimer = wx.PyTimer(self.OnNotify) self._splashtimer.Start(timeout) # Catch Some Mouse Events, To Behave Like wx.SplashScreen self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) self.Bind(wx.EVT_MOUSE_EVENTS, self.OnMouseEvents) self.Bind(wx.EVT_CHAR, self.OnCharEvents) self.Show()