I'm making a DB "manager" to practice a bit and ran into an absurd problem, which I have no idea why.
It turns out that in a section the name of the database is selected through an Entry, the problem is that when wanting to obtain this name and pass it as a variable, it simply does not grab anything. I try doing prin() in the terminal and it just prints a blank.
botonvalor= IntVar()
def connect():
root3=Tk()
root3.title("Conectar...")
Label(root3, text="Introduce el nombre de la base").grid(row=0, column=0)
nombre= StringVar()
box=Entry(root3,textvariable=nombre)
box.grid(row=1, column=0)
boton2=Button(root3, text="Aceptar",command= botonvalor.set(1))
boton2.grid(row=2, column=0)
root3.wait_variable(botonvalor)
nombre2=nombre.get()
print(nombre2)
root3.mainloop()
With the code like this, it doesn't directly print anything, it remains inert so to speak.
But taking out the button command and everything related to the buttonvalue variable, it prints blank...