Hello,
I am trying to get a simple script running that uses wxpTags under Windows 7. This works with Python 2.7 and wxPython 2.9.3.1, but fails under Python 3.3 and Phoenix 2.9.5.81-r73784
I know this has to do with the change in how the HtmlParser is connected to the HtmlWindow, but I do not know how to fix this.
Can anyone help?
The script:
#!/usr/bin/python
import wx, wx.html
import sys, os
import wx.lib.wxpTag
class HtmlWindow(wx.html.HtmlWindow):
def __init__(self, parent, id, size=(600,400)):
wx.html.HtmlWindow.__init__(self,parent, id, size=size)
class Frame(wx.Frame):
def __init__(self, title):
wx.Frame.__init__(self, None, title=title, pos=(150,150), size=(600,400))
self.Bind(wx.EVT_CLOSE, self.OnClose)
hwin = HtmlWindow(self, -1, size=(600,400))
name = 'widgetTest.htm'
hwin.LoadPage(name)
def OnClose(self, event):
self.Destroy()
app = wx.App()
top = Frame("wxpTest")
top.Show()
app.MainLoop()
The html file I am using:
<html>
<head>
<title>wxHTML does wxPython!</title>
</head>
<body bgcolor="#00CCFF">
<h2>Mixing wxPython and wxHTML</h2>
The widgets on this page were created dynamically on the fly by a
custom wxTagHandler found in wxPython.lib.wxpTag. You can look at the
sources and doc-string in the wxPython library at wx/lib/wxpTag.py.
<p>
The button below is added to the page like this:
<pre>
<center><wxp module="wx" class="Button" width="50%">
<param name="label" value="It works!">
<param name="id" value="ID_OK">
</wxp></center>
</pre>
<hr>
<center>
<wxp module="wx" class="Button" width="50%">
<param name="label" value="It works!">
<param name="id" value="ID_OK">
</wxp>
</center>
</body></html>
The Traceback:
Traceback (most recent call last):
File "c:\python33\lib\site-packages\wx\lib\wxpTag.py", line 117, in HandleTag
return self.HandleWxpTag(tag)
File "c:\python33\lib\site-packages\wx\lib\wxpTag.py", line 165, in HandleWxpT
ag
parent = self.GetParser().GetWindowInterface().GetHTMLWindow()
AttributeError: 'wxpTagHandler' object has no attribute 'GetParser'
Thanks,
Duane