Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

wx backend should not attempt to render jpeg/tiff if PIL is present.

If PIL is present, the wx backend needs to allow the base class to get the
job done for print_jpeg and print_tiff, instead of trying to take over
duties itself.
  • Loading branch information...
commit 9192c2eec3fe069a47c97cecc3ec8a2ccbaac049 1 parent 9bb698a
Daniel Hyams authored
Showing with 9 additions and 6 deletions.
  1. +9 −6 lib/matplotlib/backends/backend_wx.py
View
15 lib/matplotlib/backends/backend_wx.py
@@ -128,6 +128,7 @@ def bind(actor,event,action,id=None):
FigureCanvasBase, FigureManagerBase, NavigationToolbar2, \
cursors, TimerBase
from matplotlib.backend_bases import ShowBase
+from matplotlib.backend_bases import _has_pil
from matplotlib._pylab_helpers import Gcf
from matplotlib.artist import Artist
@@ -1132,9 +1133,10 @@ def print_figure(self, filename, *args, **kwargs):
def print_bmp(self, filename, *args, **kwargs):
return self._print_image(filename, wx.BITMAP_TYPE_BMP, *args, **kwargs)
- def print_jpeg(self, filename, *args, **kwargs):
- return self._print_image(filename, wx.BITMAP_TYPE_JPEG, *args, **kwargs)
- print_jpg = print_jpeg
+ if not _has_pil:
+ def print_jpeg(self, filename, *args, **kwargs):
+ return self._print_image(filename, wx.BITMAP_TYPE_JPEG, *args, **kwargs)
+ print_jpg = print_jpeg
def print_pcx(self, filename, *args, **kwargs):
return self._print_image(filename, wx.BITMAP_TYPE_PCX, *args, **kwargs)
@@ -1142,9 +1144,10 @@ def print_pcx(self, filename, *args, **kwargs):
def print_png(self, filename, *args, **kwargs):
return self._print_image(filename, wx.BITMAP_TYPE_PNG, *args, **kwargs)
- def print_tiff(self, filename, *args, **kwargs):
- return self._print_image(filename, wx.BITMAP_TYPE_TIF, *args, **kwargs)
- print_tif = print_tiff
+ if not _has_pil:
+ def print_tiff(self, filename, *args, **kwargs):
+ return self._print_image(filename, wx.BITMAP_TYPE_TIF, *args, **kwargs)
+ print_tif = print_tiff
def print_xpm(self, filename, *args, **kwargs):
return self._print_image(filename, wx.BITMAP_TYPE_XPM, *args, **kwargs)
Please sign in to comment.
Something went wrong with that request. Please try again.