wx.html import before creating wx.App object?

336 views
Skip to first unread message

Mark

unread,
Jun 26, 2019, 7:27:06 AM6/26/19
to wxPython-users
According to the wx.html docs "Due to some internal dynamic initialization in wxWidgets, this module should be imported before the wx.App object is created." See https://docs.wxpython.org/wx.html.1moduleindex.html

I tried _not_ doing this on a small example and didn't have any problems. So is this note still valid?

Robin Dunn

unread,
Jun 26, 2019, 1:59:30 PM6/26/19
to wxPython-users
On Wednesday, June 26, 2019 at 4:27:06 AM UTC-7, Mark wrote:
According to the wx.html docs "Due to some internal dynamic initialization in wxWidgets, this module should be imported before the wx.App object is created." See https://docs.wxpython.org/wx.html.1moduleindex.html

I tried _not_ doing this on a small example and didn't have any problems. So is this note still valid?


IIRC, the issues were somewhat obscure, so it's possible that the problem still exists but you may never run into it. 

One example that comes to mind is that if your HtmlWindow is created from an XRC-based layout, and the wx.html module is never imported in Python code, then the types defined in that module will not be known by the runtime, and methods that return a wxWindow pointer will give you a wx.Window object instead of a wx.html.HtmlWindow object. There was a similar issue that could happen even if wx.html is imported, but after the wx.App is created, but I don't recall the details at the moment.

--
Robin
Reply all
Reply to author
Forward
0 new messages