draw_if_interactive and ipython

Hi all,

I wasn't sure if this should be sent to matplotlib or ipython. I'm
got a number of questions, and any help would be greatly appreciated.
The docstring for draw_if_interactive says:

"""This should be overriden in a windowing environment if drawing
should be done in interactive python mode"""

(there should be two d's in overridden)

First, I'm not quite sure what this means....doesn't 'interactive'
imply 'interactive python mode'? So shouldn't this function always
need overriding (strange that this doesn't have two d's)?

The definition is:

    if matplotlib.is_interactive():

        figManager = Gcf.get_active()
        if figManager is not None:
            figManager.canvas.draw()

Now, when I load with ipython -pylab, the definition is:

    def wrapper(*args,**kw):
        wrapper.called = False
        out = func(*args,**kw)
        wrapper.called = True
        return out

Ipython says the definition is in genutils.py (ipython) but I can't
find it in there, and I don't know what "func" is. This is the
ipython part of my email: What does this function mean/do...and where
can I find where 'func' is defined.

Finally, the real reason for my email. I've been writing functions
which perform more complicated plot commands. In general, I don't
want the substeps to be shown, so I call matplotlib.interactive(False)
and then restore the state at the end of the function. Then I call
pylab.draw_if_interactive(). The first issue is that this doesn't
really work. Essentially this is what I am doing:

$ ipython -pylab
In [1]: ioff()
In [2]: plot(range(10))
In [3]: ion()
In [4]: draw_if_interactive()

On doing this, nothing shows up, unless I call show(). But the
following works without calling show....

$ ipython -pylab
In [1]: plot(range(10))

Why?

Assuming I can get this to work...it seems like a good solution so
long as my functions are called from "ipython -pylab", but I would
also like to be able to call such functions inside a GUI....and I am
concerned with the ramifications of the pylab.draw_if_interactive()
call. The only pylab command in the plot functions is the
draw_if_interactive...and my (wxPython) GUI uses OO matplotlib
throughout. Is this an issue? Do I need to overwrite this function?
If so, what needs to change so that I can use my functions in a GUI
(where I manually call draw) and in ipython. The quickest solution is
to have each function accept an keyword which tells it whether or not
to call draw_if_interactive()...but this is pain...and doesn't seem
very elegant. None of the matplotlib functions call
draw_if_interactive()...so perhaps there is another way to temporarily
turn off interactive mode and then restore the state.

Thanks.