rendered paste bodyimport wxfrom wx.html import HtmlWindowclass HtmlDialog(wx.MessageDialog): '''A messagedialog with HTML-formatted message''' def __init__(self, parent, title, message, style): wx.Dialog.__init__(self, parent, title = title, style = style) self.htmlwindow = HtmlWindow(self) self.okbutton = wx.Button(self, wx.ID_OK) self.cancelbutton = wx.Button(self, wx.ID_CANCEL) self.sizer = wx.BoxSizer(wx.VERTICAL) self.buttonsizer = wx.BoxSizer(wx.HORIZONTAL) self.sizer.Add(self.htmlwindow, flag = wx.EXPAND, proportion = 1) self.sizer.Add(self.buttonsizer, flag = wx.EXPAND | wx.TOP, border = 5) self.buttonsizer.Add(self.okbutton, flag = wx.EXPAND | wx.TOP, border = 5) self.buttonsizer.Add(self.cancelbutton, flag = wx.EXPAND | wx.TOP, border = 5) self.htmlwindow.SetPage(message) self.SetAutoLayout(True) self.SetSizer(self.sizer) self.Layout()if __name__ == '__main__': print "Unit testing" class MyApp(wx.App): def OnInit(self): dlg = HtmlDialog(None, "My fancy dialog", '<b>THIS</b> is <font color="red">HTML</font>!'+str(dlg.GetSize()), wx.DEFAULT_DIALOG_STYLE | wx.STAY_ON_TOP) dlg.SetPosition((wx.DisplaySize()[0], wx.DisplaySize()[1])) dlg.ShowModal() raise SystemExit app = MyApp(0) app.MainLoop()