Python Tkinter Image Added

Python Tkinter GUI

Posted by indranil on Jan. 19, 2021, 11:04 p.m.

Python Tkinter Image Added:

I'm currently in the middle of a recorded Python lecture and I think the version of python the teacher is using is outdated and he is writing a tkinter program but after copying it I keep getting this error:

Traceback (most recent call last): File "C:\Users\1234\AppData\Local\Programs\Python\Python36-32\Lecture Class 11.py", line 35, in <module> photo = PhotoImage(file="Me With My 5th Place.jpg") File

Now Open Your Text Editor And Replace It To Fix Error: 

from tkinter import *
import tkinter as tk
from PIL import Image, ImageTk
 
#Create Display And Set Display Properties
display = Tk()
frame = display.geometry("644x434")
 
#Main Attachment For Showing Image
photo = ImageTk.PhotoImage(Image.open("img.png"))
photo_label = Label(image=photo)
photo_label.pack()
 
#Display Minimize Size
display.minsize(300,200)

display.mainloop()
 
 

noimg Visit Link: digitalocean.com