Python Forum

Full Version: Tkinter Logo Image
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So I'm Trying to Create a Tkinter window and it has an icon in same folder but if I upload it on Github or change dir then it will show an error because of icon location
Is there any solution for it?

PS - Sorry for Bad Explanation LOL

from tkinter import *

root = Tk()
root.title('Password Generator')
root.geometry('350x300+400+200')
root.resizable(height=FALSE,width=FALSE)
root.iconbitmap(r"C:\Users\Evil Patrick\Desktop\Python\projects\logo.ico")

root.mainloop()
I don't think you are being clear on your explanation. Please try to express it a little differently so you can receive the information and help you need.

If your logo.ico is in a different location than your python code you would require the direct path to its location in order for it to be used. If you have your logo.ico in the same folder as your python code it will display just fine as shown in the example below, which does not require the full path being used.

from tkinter import *
 
root = Tk()
root.title('Password Generator')
root.geometry('350x300+400+200')
root.resizable(height=FALSE,width=FALSE)
root.iconbitmap(root.wm_iconbitmap('logo.ico')
 
root.mainloop()