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
  tkinter button image Nick_tkinter 4 111 Mar-04-2021, 11:33 PM
Last Post: deanhystad
  how to resize image in canvas tkinter samuelmv30 2 553 Feb-06-2021, 03:35 PM
Last Post: joe_momma
  Latex image too big on tkinter using sympy 4096 1 324 Nov-05-2020, 08:05 AM
Last Post: DPaul
Photo Tkinter TEXT background image _ShevaKadu 5 1,420 Nov-02-2020, 10:34 AM
Last Post: joe_momma
  tkinter: Image to Label Maryan 10 666 Oct-29-2020, 01:48 PM
Last Post: joe_momma
  Scrollable big image in a window (TKinter) Prospekteur 3 453 Sep-14-2020, 03:06 AM
Last Post: Larz60+
  Adding an image to a tkinter window djwilson0495 2 1,685 Aug-23-2020, 11:07 AM
Last Post: ebolisa
  Create image on a Toplevel using tkinter ViktorWong 3 2,192 Jun-13-2020, 03:21 PM
Last Post: deanhystad
  tkinter and image paths menator01 2 762 Apr-14-2020, 08:46 PM
Last Post: menator01
  [Tkinter] Image editor using Tkinter and PIL Raulica 2 1,766 Dec-03-2019, 10:10 PM
Last Post: joe_momma

Forum Jump:

User Panel Messages

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