Hi everyone I am developing a project for my school and in that same project I need to have a search box in python, I already have more or less the idea of how it develops but it is giving some errors. Sorry for my bad english but it is not my first language. here I leave my code.
import mysql.connector
from tkinter import *
con = mysql.connector.connect(
host="localhost",
user="root",
passwd="",
database="testing"
)
top = Tk()
top.title('Search form')
top.geometry("200x200")
cursor = con.cursor()
name_box = Entry()
name_box.pack(side = RIGHT, expand = True)
def search(tup):
try:
person_name = name_box.get()
cursor.execute("SELECT * FROM `admin` WHERE `email`=%s",name.box.get())
return (cursor.fetchone())
self.button = Button(self.frame, text="Display text", command=search)