When I run the programme, it shows login failed. Then I have to wait for 5 minutes before I can type in the text boxes. After I type in the details and hit the login button, it does not function for some reason. The clear and login buttons don't work. Please help me to fix this issue. Thank you in advance.
import tkinter as tk
import mysql.connector as mys
from tkinter import *
from tkinter import messagebox
from tkinter import ttk
#LOGIN FRAME
def loginscr():
def funclear():
txtUser.delete(0,END)
txtpass.delete(0,END)
def funlogin():
passw=txtpass.get()
if passw=="adis":
myconn=con=mys.connect(host="localhost",user="root",password="",database="myproject")
cursor = myconn.cursor()
messagebox.showinfo("Login Sucessful","LOGIN SUCESSFUL")
root.destroy()
menu()
else:
messagebox.showinfo("Login Failed" , "Login Failed Try Again")
root=tk.Tk()
root.geometry("300x300")
root.title("TOP GYM LOGIN")
root["background"] = "thistle1"
C=Canvas(root,bg="cyan", height=250,width=300)
lbluser=tk.Label(root,text="Username -",bg="thistle1",font=("Times New Roman Bold",10))
lbluser.place(x=50,y=50)
txtUser=tk.Entry(root, width=35, bg='thistle1', font=("Times New Roman Bold",10))
txtUser.place(x=150,y=50,width=100)
lblpass=tk.Label(root, text="Password -", bg="thistle1", font=("Times New Roman Bold", 10))
lblpass.place(x=50,y=100)
txtpass=tk.Entry(root,show="*",width=35,bg="thistle1", font=("Times New Roman Bold",10))
txtpass.place(x=150,y=100,width=100)
btnlogin=tk.Button(root, text="Login", bg="thistle1",font=("Times New Roman Bold",10), command=funlogin())
btnlogin.place(x=50,y=150,width=80)
btnclear=tk.Button(root,text="Clear",bg="thistle1",font=("Times New Roman Bold",10),command=funclear())
btnclear.place(x=150,y=150,width=80)
root.mainloop()
#THE MENU FRAME
def menu():
root = tk.Tk()
root.geometry("1200x675")
root.title("TOP GYM MANAGEMENT")
root["background"] = "thistle1"
C = Canvas(root, bg ="thistle1", height = 250, width = 300)
lblwelc = tk.Label(root, text = " MANAGEMENT SYSTEM ", fg ="black", bg="light sky blue",font = ("Times New Roman Bold", 33))
lblwelc.place(x = 490, y = 100)
btninsert = tk.Button(root, text ="INSERT",bg="light sky blue",font = ("Times New Roman Bold", 10))
btninsert.place(x = 100, y = 535, width = 150)
btnupdate = tk.Button(root, text ="UPDATE",bg="light sky blue",font = ("Times New Roman Bold", 10))
btnupdate.place(x = 300, y = 535, width = 150)
btndelete = tk.Button(root, text ="DELETE",bg="light sky blue",font = ("Times New Roman Bold", 10))
btndelete.place(x = 500, y = 535, width = 150)
btndisplay = tk.Button(root, text ="DISPLAY",bg="light sky blue",font = ("Times New Roman Bold", 10))
btndisplay.place(x = 700, y = 535, width = 150)
root.mainloop()
loginscr()