Hello,
i try to create a button with an image. Problem: The correct Path is not interpreted correctly.
When i try this code
Generally:
How to get, join and retreive pathes correctly, if possible, platform independent?
I tried with os.getcwd() and os.path.join but somehow there's always a problem...
i try to create a button with an image. Problem: The correct Path is not interpreted correctly.
When i try this code
image_path = os.path.join(self.cwd, "OpenFolder.png")
print(image_path)
open_button = Button(frame1, image=image_path)with "print(image_path) it is printing correctly (Windows):Output:C:\SVN\Python\Trunk\Projects\PhotoViewer\OpenFolder.pngbut gives the exception:Error:_tkinter.TclError: image "C:SVNPythonTrunkProjectsPhotoViewerOpenFolder.png" doesn't existSo somehow the slashes are removed or ignored. Generally:
How to get, join and retreive pathes correctly, if possible, platform independent?
I tried with os.getcwd() and os.path.join but somehow there's always a problem...
