From: W. Trevor King Date: Thu, 2 Aug 2012 16:17:21 +0000 (-0400) Subject: AFM.stepper_approach should only call figure.show if it exits. X-Git-Tag: v0.5~4 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4c1fcb8472d10b52fffb50f55ba8a9b2146bf298;p=pyafm.git AFM.stepper_approach should only call figure.show if it exits. For example, figures generated with the Agg backend don't have a 'show' method. --- diff --git a/pyafm/afm.py b/pyafm/afm.py index fc8dacb..60741c6 100644 --- a/pyafm/afm.py +++ b/pyafm/afm.py @@ -486,7 +486,8 @@ class AFM (object): axes.set_title('stepper approach {}'.format(timestamp)) plot = axes.plot(position, deflection, 'b.-') figure.canvas.draw() - figure.show() + if hasattr(figure, 'show'): + figure.show() if not _matplotlib.is_interactive(): _matplotlib_pyplot.show()