Skript zugefügt
This commit is contained in:
parent
4295804920
commit
d28901eb15
|
@ -5,3 +5,4 @@ Hier entsteht eine Sammlung meiner öfter genutzten Python-Scripts.
|
|||
## Liste
|
||||
|
||||
- mausposition_anzeigen.py: zeigt die Mausposition an
|
||||
- resource_path: Damit wird der relative Pfad von eingebundenen Dateien definiert. Wird benötigt, wenn man ein Python-Script als ausführbare Datei kompilieren möchte, in dem Dateien eingebunden werden
|
|
@ -0,0 +1,12 @@
|
|||
import sys
|
||||
import os
|
||||
|
||||
def resource_path(relative_path):
|
||||
""" Get absolute path to resource, works for dev and for PyInstaller """
|
||||
try:
|
||||
# PyInstaller creates a temp folder and stores path in _MEIPASS
|
||||
base_path = sys._MEIPASS
|
||||
except Exception:
|
||||
base_path = os.path.abspath(".")
|
||||
|
||||
return os.path.join(base_path, relative_path)
|
Loading…
Reference in New Issue