From ff92c7bcdc920d7a11a83ae981dedac8eb2c2c18 Mon Sep 17 00:00:00 2001 From: nochkin Date: Sun, 24 Jan 2021 14:40:26 -0500 Subject: [PATCH] Add the ability to run pico_project.py from other directories --- pico_project.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pico_project.py b/pico_project.py index 2a18190..e7e45ea 100755 --- a/pico_project.py +++ b/pico_project.py @@ -588,7 +588,7 @@ def init_window(self, args): mainFrame = tk.Frame(self, bg=GetBackground()).grid(row=0, column=0, columnspan=6, rowspan=12) # Need to keep a reference to the image or it will not appear. - self.logo = tk.PhotoImage(file="logo_alpha.gif") + self.logo = tk.PhotoImage(file=self._get_filepath("logo_alpha.gif")) logowidget = ttk.Label(mainFrame, image=self.logo, borderwidth=0, relief="solid").grid(row=0,column=0, columnspan=5, pady=10) namelbl = ttk.Label(mainFrame, text='Project Name :').grid(row=2, column=0, sticky=tk.E) @@ -727,6 +727,9 @@ def config(self): # Run the configuration window self.configs = ConfigurationWindow(self, self.configs).get() + def _get_filepath(self, filename): + return os.path.join(os.path.dirname(__file__), filename) + def CheckPrerequisites(): global isMac, isWindows isMac = (platform.system() == 'Darwin')