Python Tkinter help

I have a school project (We’re allowed help from any source, not cheating) to create a GUI using tkinter and read in a .db file to print the results in the GUI. The .db file is a list of game details. I have completed the code to read the .db file and the code for the GUI. However, for the final part when I have to print the list in the GUI, only the final result in the list is being displayed. The program has to be finished for 1 week today (26 January 2021) and I just need help with this final part. This is my first time using tkinter so I am aware the GUI is very simple :woozy_face: !

I’ll attach my code below:

import sqlite3
from tkinter import *
from tkinter import messagebox

def setupConnection():
    global db
    db = sqlite3.connect('gamesArchive.db')

    global c
    c = db.cursor()

    global tableName
    tableName = 'games'



def getAllGames(db):
    c.execute('''SELECT * FROM games''')
    data = []
    for row in c.fetchall():
        data.append(row)
    return data


window = Tk()
window.title("Welcome to Zach's Game Archive!")

window.configure(background='blue')

lbl = Label(window, text="Click the box to view the game archives", font=("Arial Bold", 25))

lbl.grid(column=0, row=0)
window.geometry('5000x3000')


def clicked():
    setupConnection()
    gamesData = getAllGames(db)
    for game in gamesData:
        lbl.configure(text= game, font=("Arial Bold", 8))




btn = Button(window, text="Click Me", command=clicked, bg="orange", fg="red",  height = 10, width = 20)

btn.grid(column=1000, row=1000)

window.mainloop()

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.