diff --git a/pylustrator/QComplexWidgets.py b/pylustrator/QComplexWidgets.py index 142a13b..f5965db 100644 --- a/pylustrator/QComplexWidgets.py +++ b/pylustrator/QComplexWidgets.py @@ -1346,7 +1346,11 @@ def icon(self, name: str): """ get an icon with the given filename """ pm = QtGui.QPixmap(os.path.join(os.path.dirname(__file__), "icons", name)) if hasattr(pm, 'setDevicePixelRatio'): - pm.setDevicePixelRatio(self.canvas._dpi_ratio) + try: # older mpl < 3.5.0 + pm.setDevicePixelRatio(self.canvas._dpi_ratio) + except AttributeError: + pm.setDevicePixelRatio(self.canvas.device_pixel_ratio) + return QtGui.QIcon(pm) def setSelect(self):