1

所以我正在调整图像的大小并将其添加到一个名为playingSpace 的框架中。这是那段代码:

# Opening up the image file
img = Image.open("images/gameBoard_pic.jpg")

# Resizing the image 
resized_im = img.resize((50,50))

# Making the resized image into a photoimage
final_img = ImageTk.PhotoImage(resized_im)

# Adding the image to a label widet
label = Label(playingSpace,image = final_img)

# Putting the label widget on frame
label.pack()

# Putting the frame on window
playingSpace.pack()

现在我不断收到此错误:_tkinter.TclError:图像“pyimage7”不存在。

我已经尝试换入另一张图片,但仍然出现同样的错误。

4

0 回答 0