Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

How can i display image from mysql to python gui ?

Open
#1,088 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
mysql, python
Domain
databases, desktop

Research direction

Start with the provided MySQLdb connection, SELECT LOGO query, cursor.fetchone(), and the Image.open(BytesIO(logo)) call around the reported line 9. Run the snippet and inspect the value returned by fetchone(); done means the fetched logo is accepted by the image-loading path and displayed in the Tkinter window.

Written by the indexing model from the issue text.

Description

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

Dominant language
Batchfile
Stars
29.8k
Forks
5.9k
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from realpython/python-guide

All issues in realpython/python-guide

Similar issues

More Databases issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.