From: stack Date: Mon, 9 Jul 2012 01:04:48 +0000 (+0200) Subject: absolute icon dir X-Git-Url: https://v.licheni.net/stack/code/dboxswitch.git/commitdiff_plain/0a23226fa92b41cf80501a5e0eb0de1a7edbaf78?ds=sidebyside;hp=45c3190a53e28bc5c9375794a8b154356f30ae50 absolute icon dir in case of willing to use py2exe read this http://stackoverflow.com/questions/2292703/how-can-i-get-the-executables-current-directory-in-py2exe It is already implemented using sys.argv[0] --- diff --git a/settings.py b/settings.py index 38859e7..43d7bb7 100644 --- a/settings.py +++ b/settings.py @@ -32,13 +32,19 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """ +import os, sys class Settings(): def __init__(self): + path = __file__ if __file__ is not None else sys.argv[0] + __location__ = os.path.realpath( + os.path.join(os.getcwd(), os.path.dirname(path))) + + print(os.path.join(__location__,"icon.png")) self.appname = "dboxswitch" self.appversion = "0.1" - self.icon = "./icon.png" - self.cpicon = "./current-profile.png" + self.icon = os.path.join(__location__,"icon.png") + self.cpicon = os.path.join(__location__,"current-profile.png") global conf appconf = Settings()