realpython / realpython/python-guide
How can i display image from mysql to python gui ?
未关闭
还没有人认领这个 Issue。
- 主要语言
- Batchfile
- 星标
- 29.8k
- 派生
- 5.9k
- PR 合并指标
- 30 天内没有已合并 PR
描述
I am trying , like this :
from tkinter import *
from io import BytesIO
window= Tk()
db=MySQLdb.connect("localhost","root","??","??")
cursor=db.cursor()
sql= "SELECT LOGO FROM SYSTEMDETAILS" cursor.execute(sql)
logo=cursor.fetchone()
img = Image.open(BytesIO(logo))
phimg = ImageTk.PhotoImage(img)
panel = Label(window, image = phimg)
panel.pack()
When i run this, it show error in line 9 , it want logo as an object but in here its tuple
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从提供的 MySQLdb 连接、SELECT LOGO 查询、cursor.fetchone() 以及报告的第 9 行附近的 Image.open(BytesIO(logo)) 调用开始。运行代码片段并检查 fetchone() 返回的值;当获取的 logo 被图像加载路径接受并显示在 Tkinter 窗口中时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- mysql, python
- 领域
- databases, desktop
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100