wx.html import before creating wx.App object?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

wx.html import before creating wx.App object?

Mark Summerfield
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?

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/916b6057-7cf2-494c-9cc5-1d17d3304c3f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: wx.html import before creating wx.App object?

Robin Dunn
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 <a href="https://docs.wxpython.org/wx.html.1moduleindex.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fdocs.wxpython.org%2Fwx.html.1moduleindex.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGEcFcyGAKZ6wWfG29SV7acb71Lew&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fdocs.wxpython.org%2Fwx.html.1moduleindex.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGEcFcyGAKZ6wWfG29SV7acb71Lew&#39;;return true;">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

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/28e7a404-227e-4f51-849f-3475c71fcc61%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.