Skip to content

Commit

Permalink
Merge pull request raspberrypi#8 from nochkin/relative_path
Browse files Browse the repository at this point in the history
Add the ability to run pico_project.py from other directories
  • Loading branch information
JamesH65 authored Jan 25, 2021
2 parents c95ad38 + ff92c7b commit 2409f23
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pico_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit 2409f23

Please sign in to comment.