这似乎是一个非常简单的问题,但是单击按钮时我无法显示 jpg 图像。这是我的代码(由于时间原因没有按钮代码):
from tkinter import *
#screen stuff here
canvas = Canvas(app)
canvas.grid(row = 0,column = 0)
photo = PhotoImage(file = "test.jpg")
canvas.create_image(0,0, image = photo)
def show_image():
global canvas
global photo
canvas.create_image(0,0, image = photo)
#button that calls the function down here
谢谢!