wx.html import before creating wx.App object?

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.

···

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?

Robin