AssertionError On ax.draw_artist() ????

I work matplotlib on wxpython, python2.5.
It is wonderful that the following code work faster than canvas.draw().
            canvas.restore_region(background)
            ##Updata three lines and draw it.
            line.set_data(x,y)
            ax.draw_artist(line)
            canvas.blit(ax.bbox)
            canvas.gui_repaint()
When I creat a frame and set frame.Show(True). Then ,refresh the line on
canvas with above method. It works.
However,When I creat a frame and set frame.Show(False). Then ,refresh the
line on canvas with above method. It fails. And get the following message.
'''
File "C:\Python25\Lib\site-packages\matplotlib\axes.py", line 1299, in
draw_artist
    assert self._cachedRenderer is not None
AssertionError
'''
I creat a lot of frames and do not want to show it at frist. However, when
with frame.Show(False), I can refresh the canvas. Is there any solution?
Could anyone help me? Your help will be appreciated a lot. Thanks.

···


View this message in context: http://www.nabble.com/AssertionError-On-ax.draw_artist()------tp16790306p16790306.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

You cannot call "draw_artist" until after the initial draw. So you
will either need to explicitly call fig.canvas.draw() first or put
your draw_artist command in a GUI handler that is not called until
after the initial draw event.

JDH

···

On Sat, Apr 19, 2008 at 11:23 PM, hjc520070 <jiacong_huang@...1221...> wrote:

I work matplotlib on wxpython, python2.5.
It is wonderful that the following code work faster than canvas.draw().
            canvas.restore_region(background)
            ##Updata three lines and draw it.
            line.set_data(x,y)
            ax.draw_artist(line)
            canvas.blit(ax.bbox)
            canvas.gui_repaint()
When I creat a frame and set frame.Show(True). Then ,refresh the line on
canvas with above method. It works.
However,When I creat a frame and set frame.Show(False). Then ,refresh the
line on canvas with above method. It fails. And get the following message.
'''
File "C:\Python25\Lib\site-packages\matplotlib\axes.py", line 1299, in
draw_artist
    assert self._cachedRenderer is not None
AssertionError
'''
I creat a lot of frames and do not want to show it at frist. However, when
with frame.Show(False), I can refresh the canvas. Is there any solution?
Could anyone help me? Your help will be appreciated a lot. Thanks.