Skip to content

Commit 4d4be3c

Browse files
committed
res path correct
1 parent 5edeecb commit 4d4be3c

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

QtTest.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@
33

44
def resource_path(relative_path):
55
""" Get absolute path to resource, works for dev and for PyInstaller """
6-
try:
7-
# PyInstaller creates a temp folder and stores path in _MEIPASS
8-
base_path = sys._MEIPASS
9-
except Exception:
10-
base_path = os.path.abspath(".")
11-
6+
base_path = getattr(sys, '_MEIPASS', os.path.dirname(os.path.abspath(__file__)))
127
return os.path.join(base_path, relative_path)
138

9+
1410
class MainWindow(QtWidgets.QMainWindow):
1511

1612
def __init__(self, *args, **kwargs):
@@ -90,7 +86,6 @@ def keyPressEvent(self, a0: QtGui.QKeyEvent):
9086
16777221: self.BtnEqual,
9187
16777223: self.BtnClear,
9288
}
93-
print(Button.get(key))
9489
if (Button.get(key)!=None):
9590
Button.get(key).click()
9691

0 commit comments

Comments
 (0)