2024-09-27 20:16:32 发布
网友
我在Python 3上编写了以下(非常简短)代码:
from tkinter import * from PIL import Image, ImageTk image = Image.open("Trollface.jpg") photo = ImageTk.PhotoImage(image) canvas.create_image(0, 0, image = photo)
当我运行它时,我只得到以下错误:
我做错什么了?在
您需要先创建Tk的实例:
Tk
root = Tk()
上面的代码实际上是from here。在
您需要先创建
Tk
的实例:^{pr2}$
上面的代码实际上是from here。在
相关问题 更多 >
编程相关推荐