Hi John,

I had to add a "self.canvas.Refresh()" to the end of OnButton1Button, i.e. after changing the plot within the same figure.

The "gc" and "report_memory" stuff does not work on Bill's stuff :-) .

In my app I still had a problem that figures overlapped each other.

I attach the new sample, but the code which seems to cause a problem is
         self.figure = Figure(frameon=False)

if I remove the frameon=False then things work, but I obviously get the grey background.

BTW, I don't see any memory issue using the technic shown in this sample (besides a few bytes here or there, before it grew by nearly 1 MB for each figure display.

See you

John Hunter wrote:
"Werner" == Werner F Bruhin <werner.bruhin@free.fr> writes:

    Werner> Hi All, I put a small test case together based on
    Werner> wxcursor_demo.  When clicking the button1 it should show a
    Werner> new plot, but it does not.

It does for me...

Do you mean a new plot window, or just redraw in the current figure?
You may not see that it has redrawn the figure unless you somehow
change the plot (ed pan/zoom).  I modified your example so that each
time you redraw the frequency of the sine wave changes to make it more

    Werner> I think my memory issue has to do with this as I created a
    Werner> new self.canvas each time, instead of doing a clear, but
    Werner> the big question is what do I need to call to show the new
    Werner> plot.

For one thing, add a gc.collect after you call clear to trigger the
garbage collector.

I added a memory report function and noticed something surprising.  If
I just plotted the same sine wave over and over, memory usage was
flat.  If I changed the sine wave frequency (still creating arrays of
the same size though) memory usage increased with each plot.

matplotlib does cache some information, mainly text and font stuff)
between draws which can cause memory to grow, but usually this is a
small amount.  I'll explore further.

Here is my lightly modified version of your test script.  The
report_memory function only works on unix like systems.