Python Forum
[Tkinter] Tkinter Logo Image
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Tkinter Logo Image
#1
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()

Reply
#2
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()
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Scrollable big image in a window (TKinter) Prospekteur 3 202 Sep-14-2020, 03:06 AM
Last Post: Larz60+
  Adding an image to a tkinter window djwilson0495 2 514 Aug-23-2020, 11:07 AM
Last Post: ebolisa
  Create image on a Toplevel using tkinter ViktorWong 3 1,518 Jun-13-2020, 03:21 PM
Last Post: deanhystad
  tkinter and image paths menator01 2 420 Apr-14-2020, 08:46 PM
Last Post: menator01
  [Tkinter] Image editor using Tkinter and PIL Raulica 2 1,232 Dec-03-2019, 10:10 PM
Last Post: joe_momma
  Unable to put background image on Tkinter Frame jenkins43 2 4,374 Nov-27-2019, 11:38 AM
Last Post: jenkins43
  Zooming a tkinter image GalaxyCoyote 2 2,848 Nov-09-2019, 04:36 PM
Last Post: GalaxyCoyote
  Can't load a png image tkinter Pythenx 2 3,883 May-04-2019, 05:43 PM
Last Post: woooee
  how to insert image into Text widget Tkinter atlass218 5 4,140 Apr-17-2019, 05:28 AM
Last Post: atlass218
  Display image in tkinter dan789 9 18,661 Dec-09-2018, 08:17 PM
Last Post: dan789

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020