Source code for prsctrl_gui.resources
from importlib.resources import files, as_file
from os import path
[docs]
def get_resource_path_from(module: str, rel_path: str) -> str:
with as_file(files(module)) as file:
p = path.join(file, rel_path)
return p
[docs]
def get_resource_path(rel_path: str) -> str:
"""
Convenience function to get the path to a resource file from this packages resource directory
Parameters
----------
rel_path
Path of the file relative to prsctrl_gui/resources
Returns
-------
str
Absolute path to the file
"""
return get_resource_path_from("prsctrl_gui.resources", rel_path)