AFM.stepper_approach should only call figure.show if it exits.
authorW. Trevor King <wking@tremily.us>
Thu, 2 Aug 2012 16:17:21 +0000 (12:17 -0400)
committerW. Trevor King <wking@tremily.us>
Thu, 2 Aug 2012 16:21:14 +0000 (12:21 -0400)
For example, figures generated with the Agg backend don't have a
'show' method.

pyafm/afm.py

index fc8dacbefc4f3d8e37c2776241e3206e6016b7dd..60741c63590615959b471298d7d041aa4dc3c368 100644 (file)
@@ -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()