How can i display image from mysql to python gui ?
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 25/100
调研方向
从提供的 MySQLdb 连接、SELECT LOGO 查询、cursor.fetchone() 以及报告的第 9 行附近的 Image.open(BytesIO(logo)) 调用开始。运行代码片段并检查 fetchone() 返回的值;当获取的 logo 被图像加载路径接受并显示在 Tkinter 窗口中时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
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
- 主要语言
- Batchfile
- 星标
- 29.8k
- 派生
- 5.9k
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
realpython/python-guide 的其他 Issue
-
Page 404 error 未关闭
难度 1/5 1 小时以内 新手友好度 65/100
realpython/python-guide#1104 · 2 条评论 ·
-
难度 1/5 1-3 小时 新手友好度 62/100
realpython/python-guide#327 ·
-
难度 2/5 1-3 小时 新手友好度 62/100
realpython/python-guide#326 · 5 条评论 ·
-
@alex 未关闭
难度 5/5 一周以上 新手友好度 10/100
realpython/python-guide#1194 ·
-
难度 5/5 一周以上 新手友好度 10/100
realpython/python-guide#1192 ·
查看 realpython/python-guide 的全部 Issue
相似的 Issue
-
Edit: CW+ 未关闭channels:edit check:passed
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 1/5 1 小时以内 新手友好度 90/100
-
难度 2/5 1-3 小时 新手友好度 68/100
community-scripts/ProxmoxVE#17396 · 1 条评论 ·
-
bug possible-duplicate
难度 2/5 1-3 小时 新手友好度 88/100
AOSSIE-Org/PictoPy#1553 · 4 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
BasedHardware/omi#15274 · 3 条评论 ·