I've been adapting somebody's else simple project for my needs. Inside the project directory there's icons
directory. In the original project those icons get loaded like this (tkinter
):
root.iconbitmap('icons/pypad.ico')
Looks fair enough, but I can't load them. The paths check; this works:
def rcpath(rel_path):
os.path.join(os.getcwd(), rel_path)
root.iconbitmap(rcpath('icons/pypad.ico'))
Why the trouble? It should work just as it used to work originally. The original project is in Python 2, I'm adapting it to Python 3, which is probably irrelevant.
UPD:
The actual problem is discussed here, and a number of solutions offered. I've adopted this one:
rooticon = PhotoImage(file='icons/pypad.gif')
root.tk.call('wm', 'iconphoto', root._w, rooticon)