Error catching in wx.html2 window

72 views
Skip to first unread message

Joel Burton

unread,
May 28, 2012, 1:30:18 AM5/28/12
to wxpytho...@googlegroups.com
I'm using a wx.html2 (wx2.9) window to show an HTML help file. This works fine, but I can't figure out how to catch any errors.

It's possible that the user might get a site-down or 404 error. Is there a way to catch these errors? (Or any more detailed information on the new html2 control?)

In the attached code, I'd hoped OnError would be called and would raise an exception--but it never seems to be.

Thanks for any help. 
web.py

Gadget/Steve

unread,
May 28, 2012, 2:58:45 AM5/28/12
to wxpytho...@googlegroups.com
> --
> To unsubscribe, send email to wxPython-user...@googlegroups.com
> or visit http://groups.google.com/group/wxPython-users?hl=en

I think your problem lies in the call
wv.Bind(wx.html2.EVT_WEB_VIEW_ERROR, self.OnError, wv) try deleting the
wv parameter as the Bind function is shown as taking an integer
representing the id of the window/menu/button/first of a range of ids.
You a passing the wv object which may not be the correct thing.

Gadget/Steve

Robin Dunn

unread,
May 28, 2012, 4:19:28 PM5/28/12
to wxpytho...@googlegroups.com
That parameter will have its GetId() called if needed, but in this case
since Bind is being called on the wv object it should be unnecessary
anyway. (Because passing no item or Id means the binding will match an
event from any widget when that event propagates past the widget doing
the binding (wv) and since there can only be one in this case then there
is no need to provide an item/id for the binding.)

BTW it looks like protocol typos are what is not triggering that event,
but it does work for other types of navigation problems. If I change it
to:

wv.LoadURL("http://fubar.yadda.yahoo.com")

Then I do see the event here (on wxOSX-cocoa with 2.9.4 preview)

--
Robin Dunn
Software Craftsman
http://wxPython.org

Joel Burton

unread,
May 28, 2012, 5:41:58 PM5/28/12
to wxpytho...@googlegroups.com
Perfect, thanks!

Reply all
Reply to author
Forward
0 new messages