Im writing an app using tkinter, and the app when the button is pressed connects to sql DB and runs sql queries. I am running into an issue where the GUI says "not responding" while the sql querys method is running, and when its done it goes back to normal. I decided to put the sql query in its own thread and the mainloop of tkinter in its own thread, but its not working at all...?
def createGUI():
window = Tk()
window.title("Recon Report Generator")
lbl=Label(window, text="Enter Recon File Below", fg='blue', font=("Helvetica", 16))
lbl.place(x=90,y=50)
textBox=Entry(window, text="This is Entry Widget", bd=5)
textBox.place(x=135, y=100)
button=Button(window, height=1, width=15, text="Find Missing",
command=lambda: retrieve_input(textBox,lbl))
button.place(x=140, y=150)
window.geometry("400x400")
window.resizable(False, False)
_thread.start_new_thread(window.mainloop(), (0,))
This is my GUI I put the mainloop in thread 0
and here
def retrieve_input(textBox,lbl):
detFile = "'"+(textBox.get())+"'"
lbl.place(x=140,y=50)
lbl.config(text="Enter Recon File Below")
_thread.start_new_thread(runDatabaseQuerys(detFile), (1,))
lbl.config(text="Finished...")
print("Finished Please check file")
i put the sql query running method in thread 1 they are indepnedant threads, but i am still getting "not responding"???