My problem looks like wxHtmlWindow in XRC file is misinterpretted as
wxScrolledWindow when loaded with XML resources. I'm using
wxPython2.7-win32-ansi-2.7.1.3-py24.exe on Win98.
I'm having this simple xrc file called "bugtest.xrc" (generated with
xrced):
<?xml version="1.0" encoding="cp1250"?>
<resource>
<object class="wxDialog" name="ID_Dialog">
<title></title>
<object class="wxBoxSizer">
<orient>wxVERTICAL</orient>
<object class="sizeritem">
<object class="wxTextCtrl" name="ID_Text">
<value>Hello, world.</value>
</object>
<option>1</option>
<flag>wxEXPAND|wxGROW</flag>
</object>
<object class="sizeritem">
<object class="wxHtmlWindow" name="ID_Html">
<htmlcode>Hello, <b>world</b>.</htmlcode>
</object>
<option>1</option>
<flag>wxEXPAND|wxGROW</flag>
</object>
<object class="sizeritem">
<object class="wxButton" name="ID_But">
<label>Change texts</label>
</object>
</object>
</object>
<size>300,300</size>
</object>
</resource>
and this simple testing program called "bugtest.py":
import wx
from wx import xrc
class TestApp(wx.App):
def OnInit(self):
xrc.XmlResource.Get().InitAllHandlers()
self.resources = xrc.XmlResource('bugtest.xrc', 0)
self.dlg = self.resources.LoadDialog(None, 'ID_Dialog')
self.dlg.Show()
self.dlg.Bind(wx.EVT_BUTTON, self.on_button, id = xrc.XRCID('ID_But'))
return True
def on_button(self, evt = None):
xrc.XRCCTRL(self.dlg, 'ID_Text').SetValue("New Text")
xrc.XRCCTRL(self.dlg, 'ID_Html').SetPage("New Text")
print "but pressed"
if __name__ == "__main__":
app = TestApp(0)
app.MainLoop()
when I run it and press the "Change texts" button, the text in TextCtrl
is changed correctly, but an AttributeError is raised for
wxHtmlWindow.SetPage():
File "bugtest.py", line 27, in on_button
xrc.XRCCTRL(self.dlg, 'ID_Html').SetPage("New Text")
AttributeError: 'ScrolledWindow' object has no attribute 'SetPage'
What am I doing wrong? Is this a bug, and if so, is there any quick
workaround?
Thanks a lot, best regards..
tomas dvorak
···
--
http://www.fastmail.fm - Accessible with your email software
or over the web