1) On my win platform, - win98, Py 2.3.3, wxPy 2.4.2.4- I can call
wxInitAllImageHandlers() several times without any problems;
the several wxInitAllImageHandlers() being in the same module or
spread in different modules. However, I do not know what happens
behind the scene (memory?, ....)
--- snip ---
I think where this changes is in V2.5. Pertinent is the first section of
the migration docs:
Module Initialization
The import-startup-bootstrap process employed by wxPython was changed such
that wxWindows and the underlying gui toolkit are not initialized until the
wx.App object is created (but before wx.App.OnInit is called.) This was
required because of some changes that were made to the C++ wxApp class.
There are both benefits and potential problems with this change. The
benefits are that you can import wxPython without requiring access to a GUI
(for checking version numbers, etc.) and that in a multi-threaded
environment the thread that creates the app object will now be the GUI
thread instead of the one that imports wxPython. Some potential problems are
that the C++ side of the "stock-objects" (wx.BLUE_PEN, wx.TheColourDatabase,
etc.) are not initialized until the wx.App object is created, so you should
not use them until after you have created your wx.App object. If you do then
an exception will be raised telling you that the C++ object has not bene
initialized yet.
Also, you will probably not be able to do any kind of GUI or bitmap
operation unless you first have created an app object, (even on Windows
where most anything was possible before.)
--- /snip ---
So, in essence, the end-developer is the one creating the wx.App, not the
library, and wx.InitAllImageHandlers() is, while not an actual bitmap
operation, closely tied to the use of bitmaps and images, I think we can
agree.
This probably needs to be explicitly stated in the migration guide,
somewhere.
2) I find the remark from Chris Barker very pertinent.
The question in not only relevant for the demo.
If wxInitAllImageHandlers() causes problems when called
several times, what do happen if an application uses a third-party
Python module, that already contains a wxInitAllImageHandlers()
statement? A user is not supposed -fortunately- to inspect all
the modules she/he is using.
This is where good documentation is going to be important. I *can* assure
you that all of the contributed wx.lib modules will have this taken into
account (either Robin or I have already attended to this).