Python Forum
tkinter: Image to Label
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
tkinter: Image to Label
#5
If I pass 'fileimg' directly to the PhotoImage(file = fileimg), I'm getting error ( no such file ). So my thought was first to store it in 'memory' and then pass it to photoimage :|
With print(type(content),content) it will read the image in bytes <class 'bytes'>. Content suppose to be the Image file that I open it with filedialog. I have only 1-2 months expirence with python, I'm not sure if I can find the solution by myself. Sad

Update:
img = PhotoImage(content)
now is not taking the image from file, but I'm getting another TypeError.
#TypeError: __str__ returned non-string (type bytes)
#<class 'tkinter.PhotoImage'>


(Oct-28-2020, 08:11 PM)deanhystad Wrote: PhotoImage asks for a file. Why are you reading the file and passing the contents?
Reply


Messages In This Thread
tkinter: Image to Label - by Maryan - Oct-28-2020, 06:05 PM
RE: tkinter: Image to Label - by deanhystad - Oct-28-2020, 06:16 PM
RE: tkinter: Image to Label - by Maryan - Oct-28-2020, 06:58 PM
RE: tkinter: Image to Label - by deanhystad - Oct-28-2020, 08:11 PM
RE: tkinter: Image to Label - by Maryan - Oct-29-2020, 12:22 AM
RE: tkinter: Image to Label - by deanhystad - Oct-29-2020, 12:39 AM
RE: tkinter: Image to Label - by Maryan - Oct-29-2020, 01:00 AM
RE: tkinter: Image to Label - by deanhystad - Oct-29-2020, 02:34 AM
RE: tkinter: Image to Label - by buran - Oct-29-2020, 05:57 AM
RE: tkinter: Image to Label - by Maryan - Oct-29-2020, 11:47 AM
RE: tkinter: Image to Label - by joe_momma - Oct-29-2020, 01:48 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Tkinter: An image and label are not appearing. emont 7 574 Mar-21-2024, 03:00 PM
Last Post: deanhystad
  tkinter destroy label inside labelFrame Nick_tkinter 3 4,545 Sep-17-2023, 03:38 PM
Last Post: munirashraf9821
  My Background Image Is Not Appearing (Python Tkinter) HailyMary 2 4,236 Mar-14-2023, 06:13 PM
Last Post: deanhystad
  [Tkinter] Load image and show in label ko_fal 8 3,043 Oct-25-2022, 09:20 AM
Last Post: ko_fal
  [Tkinter] Updating Tkinter label using multiprocessing Agusms 6 3,133 Aug-15-2022, 07:10 PM
Last Post: menator01
  simple tkinter question function call not opening image gr3yali3n 5 3,424 Aug-02-2022, 09:13 PM
Last Post: woooee
  [Tkinter] Tkinter don't change the image DQT 2 1,615 Jul-22-2022, 10:26 AM
Last Post: menator01
  [Tkinter] The Text in the Label widget Tkinter cuts off the Long text in the view malmustafa 4 4,850 Jun-26-2022, 06:26 PM
Last Post: menator01
  How to redraw an existing image to a different image TkInter zazas321 6 5,875 Jul-08-2021, 07:44 PM
Last Post: deanhystad
  [Tkinter] image in label not showing? rwahdan 2 8,158 Jun-25-2021, 10:27 AM
Last Post: rwahdan

Forum Jump:

User Panel Messages

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