can't get document property of wx.lib.iewin.IEHtmlWindow

Cao Xiao Hua caoxiaohua at dsa.com.cn
Tue Mar 4 23:36:52 PST 2008


Hell all,

I am trying to use wx.lib.iewin.IEHtmlWindow to display a html page, and
get the user input from "<input >". error occurs when I try to get the
"document" property.

here is the error message:

Traceback (most recent call last):
  File "W:\Python\Report\report.py", line 32, in OnGetButton
 el = self.ie.document
 File "C:\Python25\lib\site-packages\wx-2.8-msw-unicode\wx\lib
\iewin.py", line 252, in _get_Document
 return self.GetAXProp('Document')
  File "C:\Python25\lib\site-packages\wx-2.8-msw-unicode\wx\activex.py",
line 324, in GetAXProp
 return _activex.ActiveXWindow_GetAXProp(*args, **kwargs)
TypeError: Unable to convert value to expected type: (VT_EMPTY) for
property <Document>


I am using Python2.5 ,wxPython2.8.7.1 under XP

I search in this news groups, and found it was reported in 2004.
http://lists.wxwidgets.org/archive/wxPython-users/msg27343.html

Does this problem still exist? or I miss something.

Best Regards!

Jason Cao

#----------------------------------------------------------
import wx
import wx.lib.iewin as iewin

class IEFrame(wx.Frame):

	def __init__(self, parent, id):
		wx.Frame.__init__(self, parent, id, 'Frame With button',
				size = (700, 400))

		self.current = "http://www.google.com"
	
		sizer = wx.BoxSizer(wx.VERTICAL)
		self.SetSizer(sizer)
		self.SetAutoLayout(True)
		
		btnSizer = wx.BoxSizer(wx.HORIZONTAL)
		btn = wx.Button(self, -1, "Get", size = (25,25), pos = (600, 305))
		self.Bind(wx.EVT_BUTTON, self.OnGetButton, btn)
		btnSizer.Add(btn, 0, wx.EXPAND|wx.ALL, 2)
		
		self.ie = iewin.IEHtmlWindow(self, -1, style =
wx.NO_FULL_REPAINT_ON_RESIZE)
		self.ie.LoadUrl(self.current)

		sizer.Add(btnSizer, 0, wx.EXPAND)
		sizer.Add(self.ie, 1, wx.EXPAND)
		
		
	def OnGetButton(self, event):
		el = self.ie.document

if __name__ == '__main__':
	app = wx.PySimpleApp()
	frame = IEFrame(parent = None, id = -1)
	frame.Show()
	app.MainLoop()





More information about the wxpython-users mailing list