import tkinter as tk #导入Tkinter from PIL import Image, ImageTk root = tk.Tk() root.title('图片演示') #设置窗口标题 root.geometry('759x500') photo=Image.open(fr"C:\\Users\\Lenovo\\Desktop\\选股系统\\界面2.jpg") #读入数据 img=ImageTk.PhotoImage(photo) #转换为Tkinter图像格式 label_img = tk.Label(root, image=img).grid(row=0, column=0) label_img.pack() root.mainloop()
TclError Traceback (most recent call last) <ipython-input-18-215e4be4b67c> in <module> 6 photo=Image.open("界面2.jpg") #读入数据 7 img=ImageTk.PhotoImage(photo) #转换为Tkinter图像格式 ----> 8 label_img = tk.Label(root, image=img).grid(row=0, column=0) 9 label_img.pack() 10 root.mainloop() ~\anaconda3\lib\tkinter\__init__.py in __init__(self, master, cnf, **kw) 3141 3142 """ -> 3143 Widget.__init__(self, master, 'label', cnf, kw) 3144 3145 ~\anaconda3\lib\tkinter\__init__.py in __init__(self, master, widgetName, cnf, kw, extra) 2565 for k, v in classes: 2566 del cnf[k] -> 2567 self.tk.call( 2568 (widgetName, self._w) + extra + self._options(cnf)) 2569 for k, v in classes: TclError: image "pyimage11" doesn't exist
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!