Wxpython HtmlWindow和自定义标记处理程序发生崩溃
使用Wxpython HtmlWindow和自定义标记处理程序发生崩溃,wxpython,Wxpython,使用HtmlWindow和自定义标记处理程序,我得到一个断言错误,即某些内容未初始化,我需要帮助来取消我必须初始化的内容: 按“否”后,我在控制台中收到一条消息: swig/python detected a memory leak of type 'wxPyHtmlWinTagHandler *', no destructor found. 在Linux下,该程序在没有消息的情况下工作。这个问题出现在Windows2000、Python2.7.8和Wxpython3.0.1下。该计划本身:
HtmlWindow
和自定义标记处理程序,我得到一个断言错误,即某些内容未初始化,我需要帮助来取消我必须初始化的内容:
按“否”后,我在控制台中收到一条消息:
swig/python detected a memory leak of type 'wxPyHtmlWinTagHandler *', no destructor found.
在Linux下,该程序在没有消息的情况下工作。这个问题出现在Windows2000、Python2.7.8和Wxpython3.0.1下。该计划本身:
import wx, wx.html
class VarTagHandle(wx.html.HtmlWinTagHandler):
def __init__(self):
wx.html.HtmlWinTagHandler.__init__(self)
def GetSupportedTags(self):
return "V"
def HandleTag(self, tag):
print "HandleTag V"
return False
class MyFrame(wx.Frame):
def __init__(self, *ls, **kw):
wx.Frame.__init__(self, *ls, **kw)
h = wx.html.HtmlWindow(self)
h.SetPage("<h1>Test</h1><p><V></V>Hello, world!</p>")
app = wx.App()
wx.html.HtmlWinParser_AddTagHandler(VarTagHandle)
wnd = MyFrame(None, title="Just a window", size=(400,400))
wnd.Show(1)
app.MainLoop()
导入wx,wx.html
类VarTagHandle(wx.html.HtmlWinTagHandler):
定义初始化(自):
html.HtmlWinTagHandler.\uuuu init\uuuuu(self)
def GetSupportedTags(自身):
返回“V”
def手柄(自身,标签):
打印“HandleTag V”
返回错误
类MyFrame(wx.Frame):
def _初始功率(自,*ls,**kw):
wx.帧。\uuuuu初始\uuuuuuuux(自,*ls,**kw)
h=wx.html.HtmlWindow(self)
h、 SetPage(“Test你好,世界!”)
app=wx.app()
HtmlWinParser\u AddTagHandler(VarTagHandle)
wnd=MyFrame(无,title=“只是一个窗口”,大小=(400400))
wnd.Show(1)
app.MainLoop()
必须是Windows 2000产品。我只是在Windows7上用WxPython3.0.2.0和Python2.7.9运行了它,效果很好。我想你可以升级到最新的wxPython来确保。