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