Making Messagebox show results

52 views Asked by At

(using python) In my section "Def display_record():" I can not get the messagebox.showinfo(results) to pop up and show the result.

The error I get is "Expected type 'str | None', got 'list' instead" I tried a couple different version with my fetchall() to see if I needed to make it a list before going into message box. However that did not work. Not sure what the issue is.

The result I should be getting from my products.db. An example of the values are: ("INSERT INTO PRODUCTS VALUES (1, 'Hardware', 'Grommets', 1.99, 25)") They are broken up by (ID, PRODCATEGORY, PRODNAME, PRICE, ONHAND)

def display_record():
    try:
        product = (Product_text.get())
        sql_insert_command = ''' SELECT * FROM products WHERE PRODNAME = ?'''
        cursor.execute(sql_insert_command, (product))
        result = (cursor.fetchall())
        messagebox.showinfo(result)
    except:
        messagebox.showerror('Failed!')
0

There are 0 answers