Python Forum
Adding an image to a tkinter window
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding an image to a tkinter window
#2
Good job on the topic. Next time post GUI questions to the GUI part of this forum.

Also next time create a shorter example with the fewest number of external dependencies possible. People are more likely to offer help if you make it easy for them. This is all that's required to demonstrate your problem.
from tkinter import *
window = Tk()
logo = PhotoImage(file = "image.gif")
I took a .png file I had and converted to .gif and I get the same error you do. Then I changed the code to use the .png file and it works. Guess this is another incompatible file format problem. Interesting since effbot says .gif is a compatible format. Hmmmm.

If you want to work with images I think you should take a look at the Python Imaging Library (PIL). If you really want to do GUI programming I think you should look into something newer and better than Tk. Anything is newer and better than Tk.
Reply


Messages In This Thread
RE: Adding an image to a tkinter window - by deanhystad - Aug-05-2020, 08:48 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Tkinter: An image and label are not appearing. emont 7 851 Mar-21-2024, 03:00 PM
Last Post: deanhystad
  Interaction between Matplotlib window, Python prompt and TKinter window NorbertMoussy 3 679 Mar-17-2024, 09:37 AM
Last Post: deanhystad
  Tkinter multiple windows in the same window tomro91 1 927 Oct-30-2023, 02:59 PM
Last Post: Larz60+
  Centering and adding a push button to a grid window, TKinter Edward_ 15 5,288 May-25-2023, 07:37 PM
Last Post: deanhystad
  My Background Image Is Not Appearing (Python Tkinter) HailyMary 2 4,578 Mar-14-2023, 06:13 PM
Last Post: deanhystad
  simple tkinter question function call not opening image gr3yali3n 5 3,570 Aug-02-2022, 09:13 PM
Last Post: woooee
  [Tkinter] Tkinter don't change the image DQT 2 1,692 Jul-22-2022, 10:26 AM
Last Post: menator01
  [Tkinter] Open tkinter colorchooser at toplevel (so I can select/focus on either window) tabreturn 4 2,013 Jul-06-2022, 01:03 PM
Last Post: deanhystad
  [Tkinter] Background inactivity timer when tkinter window is not active DBox 4 3,003 Apr-16-2022, 04:04 PM
Last Post: DBox
  why my list changes to a string as I move to another window in tkinter? pymn 4 2,633 Feb-17-2022, 07:02 AM
Last Post: pymn

Forum Jump:

User Panel Messages

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