Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f92e79c

Browse files
authored
Merge pull request #8559 from cgohlke/patch-1
Fix: AttributeError: 'QPixmap' object has no attribute 'setDevicePixelRatio'
2 parents cab1abd + d2a0a0b commit f92e79c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/matplotlib/backends/backend_qt5.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,8 @@ def _icon(self, name):
588588
if is_pyqt5():
589589
name = name.replace('.png', '_large.png')
590590
pm = QtGui.QPixmap(os.path.join(self.basedir, name))
591-
pm.setDevicePixelRatio(self.canvas._dpi_ratio)
591+
if hasattr(pm, 'setDevicePixelRatio'):
592+
pm.setDevicePixelRatio(self.canvas._dpi_ratio)
592593
return QtGui.QIcon(pm)
593594

594595
def _init_toolbar(self):

0 commit comments

Comments
 (0)