From 83ccf71cf6577310b6907bf60dde40b8f2ba2661 Mon Sep 17 00:00:00 2001 From: hyunil Date: Thu, 11 Jul 2019 16:30:28 +0900 Subject: [PATCH] Fixed AttributeError bug in mouse wheel event --- nodz_main.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/nodz_main.py b/nodz_main.py index 1c54147..24b1355 100644 --- a/nodz_main.py +++ b/nodz_main.py @@ -80,10 +80,16 @@ def wheelEvent(self, event): inFactor = 1.15 outFactor = 1 / inFactor - if event.delta() > 0: - zoomFactor = inFactor - else: - zoomFactor = outFactor + try: + if event.delta() > 0: + zoomFactor = inFactor + else: + zoomFactor = outFactor + except AttributeError: + if event.angleDelta().y() > 0: + zoomFactor = inFactor + else: + zoomFactor = outFactor self.scale(zoomFactor, zoomFactor) self.currentState = 'DEFAULT'