Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pillow
#1
from tkinter import *
from PIL import Image,ImageTk

root = Tk()

img = ImageTk.PhotoImage(Image.open('red-circle.png'))
label = Label(image=my_img)
label.pack

root.mainloop()
When I run this, I get this error: FileNotFoundError: [Errno 2] No such file or directory: 'red-circle.png'.

I want to upload an image into my program and I saw that Pillow (PIL) was a good option. I've been trying for half an hour now but i just dont know how i can upload/import an image into my program. Does somebody know what is the best way to do this?
Thanks in advance!
Reply


Messages In This Thread
Pillow - by juuls04 - Dec-29-2019, 09:25 PM
RE: Pillow - by Larz60+ - Dec-29-2019, 09:30 PM
RE: Pillow - by juuls04 - Dec-29-2019, 09:45 PM
RE: Pillow - by Larz60+ - Dec-30-2019, 02:09 AM
RE: Pillow - by joe_momma - Dec-30-2019, 04:55 AM

Forum Jump:

User Panel Messages

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