Ok. Now suppose you write an application that runs a set of algorithms not known in advance. These algorithms may or may not create figures depending on what they perform; they may also encounter difficulties (e.g. not enough input data) so that none of them is finally able to create a figure. As this is always better to dissociate code pieces the more as possible, I'd prefer not to use a global variable to trace figure creation. So is there a way to know that no figure was created?
Jean-Michel> It seems that show() hangs if no figure has been
Jean-Michel> created before calling (under matplotlib 0.62.4). Am
Jean-Michel> I wrong or is it an unexpected use of show() ?
show should be the last line of your script. It is expected to hang.
It starts the GUI mainloop after which all processing is done in the
GUI event handling (unless you are using threading).