import wx import threading import SimpleXMLRPCServer import wx.lib.newevent import wx.lib.fancytext as fancytext NewMessageEvent, EVT_NEW_MESSAGE = wx.lib.newevent.NewEvent() class StaticFancyText(wx.StaticBitmap): def __init__(self, window, id, text, *args, **kargs): args = list(args) kargs.setdefault('name', 'staticFancyText') if 'background' in kargs: background = kargs.pop('background') elif args: background = args.pop(0) else: background = wx.Brush(window.GetBackgroundColour(), wx.SOLID) bmp = fancytext.RenderToBitmap(text, background, enclose = 1) wx.StaticBitmap.__init__(self, window, id, bmp, *args, **kargs) class MessageWindow(wx.Frame): def __init__(self, title, msg): wx.Frame.__init__(self, None, -1, size=(350, 50), style = wx.STAY_ON_TOP | wx.FRAME_TOOL_WINDOW | wx.FULL_REPAINT_ON_RESIZE) self.Bind(wx.EVT_MOTION, self.OnMotion) self.hiding = False #self.sizer = wx.BoxSizer(wx.VERTICAL) #print title, msg self.title = StaticFancyText(self, -1, str('%s' % title)) self.body = StaticFancyText(self, -1, str('%s' % msg)) #self.title = wx.StaticText(self, -1, str(title), (3, 3)) #self.body = wx.StaticText(self, -1, str(msg), (3, 15)) #b = 10 #self.sizer.Add(self.title, 1, wx.EXPAND | wx.ALL, b) #self.sizer.Add(self.body, 1, wx.EXPAND | wx.ALL, b) #self.SetSizer(self.sizer) #self.title.SetForegroundColour((255, 255, 255)) #self.body.SetForegroundColour((255, 255, 255)) #font = self.title.GetFont() #font.SetWeight(wx.FONTWEIGHT_BOLD) #self.title.SetFont(font) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.title, 0, wx.ALL|wx.ADJUST_MINSIZE, 2) sizer.Add(self.body, 0, wx.ALL|wx.ADJUST_MINSIZE, 2) self.SetAutoLayout(True)