I'm beginner on python and i cannot understand why my code is not working... It only works when you not put anything and clicking the button instead. import tkinter as tk from tkinter import messagebox from tkinter import * from tkinter.ttk import * from sqlalchemy import * from sqlalchemy.orm import * Base = declarative_base() class usuario(Base): __tablename__='usuarios' id = Column(Integer, primary_key=True) nombre = Column(VARCHAR(50)) correo = Column(VARCHAR(100)) passw = Column(VARCHAR(50)) permiso = Column(Integer) fecha = Column(TIMESTAMP) engine = create_engine("mysql+mysqlconnector://root:esm1@localhost/usuariosesm", echo=False) Session = sessionmaker(bind=engine) session = Session() #Login. def login(nid,pssw): if not nid or not pssw: print("Por favor, ingrese su usuario y contraseña") messagebox.showerror("Error", "Por favor, ingrese su usuario y contraseña") return try: user = session.query(usuario).filter_by(id=int(nid), passw=pssw).first() if user: print("Login exitoso") messagebox.showinfo("Exito", "Login exitoso") else: print("Usuario o contraseña incorrectos") messagebox.showerror("Error", "Usuario o contraseña incorrectos") except Exception as e: print(f"Error al iniciar sesión: {e}") messagebox.showerror("Error", f"Error al iniciar sesión: {e}") #Ventana principal. if __name__ == "__main__": root = tk.Tk() root.title("Login") root.geometry("300x200") label_id = tk.Label(root, text="ID:") label_id.pack(pady=5) entry_id = tk.Entry(root) entry_id.pack(pady=5) label_passw = tk.Label(root, text="Contraseña:") label_passw.pack(pady=5) entry_passw = tk.Entry(root, show="*") entry_passw.pack(pady=5) button_login = tk.Button(root, text="Iniciar Sesión", command=lambda: login(entry_id.get(), entry_passw.get()).pack()) button_login.pack(pady=20) button_exit = tk.Button(root, text="Salir", command=root.quit) button_exit.pack(pady=5) root.mainloop() The database name and the data that i try to match are ok. Db schema: Table: usuarios Columns: id int AI PK nombre varchar(50) correo varchar(100) passw varchar(50) permiso int fecha timestamp I'm trying to make a login using mysql connector, sqlalchemy and tkinter gui, the data in the db are perfectly fine. At the moment on typing id and password and click on the button, nothing is coming up and the prompt doesn't show anything. Sorry for my weak english, i just need some help, thank you Continue reading...