Hi I have a python search which works well and then I have a tkinter GUI which accepts a user input. The user input is then used to query the database using python. It matches records together depending on the input for example it would match blue to blue when I need it to be able to match blue to Blue etc. Does anybody know how to do this, here is an example of what I have already(N.B it is a made up scenario);
def Search():
global E1, E2, E3, E4, file
#Open the file in read mode
file = sqlite3.connect('H:\\matching.db')
#Welcome message
print ("Please type in the information required")
window = Tk()
window.title ("Search for matches")
def QuitSearch():
window.destroy()
#Create text that will be shown to the user
window.configure(bg="red")
Label(window, text="Please enter the colour of your hair").grid(row=0)
Label(window, text="Please enter the colour of your eyes").grid(row=1)
Label(window, text="Please enter your gender").grid(row=2)
Label(window, text="Please enter your shoe size").grid(row=3)
#Create where the user will input
E1= Entry(window)
E2= Entry(window)
E3= Entry(window)
E4= Entry(window)
#Assigning the input boxes to area on the screen
E1.grid(row=0, column=1)
E2.grid(row=1, column=1)
E3.grid(row=2, column=1)
E4.grid(row=3, column=1)
button = Button(window, text = "Submit information", command=Submit, fg="yellow", bg="black")
button.grid(row=3, column=2, padx = 5)
quitbutton = Button (window, text ="QUIT", command=QuitSearch, fg ="red")
quitbutton.grid(row=3, column=3, padx=5)
#The submit function allows the data inserted by the user in Search to be submitted and to search the database
def Submit():
global E1, E2, E3, E4, file
#Retaining user input
eyecolour = E1.get()
haircolour = E2.get()
gender = E3.get()
shoesize = E4.get()
#The search
cursor = file.execute ('''SELECT ID, forename, surname, FROM people
WHERE eyecolour =? and haircolour=? and gender=? and shoesize=? ''', (eyecolour, haircolour, gender, shoezize))
window=Tk()
def QuitOutputScreen():
window.destroy()
for row_number, row in enumerate(cursor):
Label(window, text ="ID = "+ str(row[0])).grid(row=1, column = row_number)
Label(window, text ="Forename = "+str(row[1])).grid(row=2, column = row_number)
Label(window, text ="Surname = "+(row[2])).grid(row=3, column = row_number)
Label(window, text ="Search complete ").grid(column=11)
quitbutton = Button (window, text ="QUIT", command=QuitOutputScreen, fg ="red")
quitbutton.grid(row=11, column=11, padx=5)
file.close()