The from tkinter import *
H=Tk ()
I=Frame (h)
I.p ack (padx=100, pady=10)
V1=StringVar ()
V2=StringVar ()
V3=StringVar ()
Entry (I, textvariable=v2, show=",, "width=10, validate=" none "). The grid (row=0, the column=2)
A=STR (v2. The get ())
Def (o) :
If a!="23148979 ac" :
V3. Set (" login failed ")
The else:
V3. Set (" login succeeds ")
Textvariable=v1, Label (I) the grid (row=0, the column=0)
Label (I, textvariable=v3). The grid (row=1, the column=1)
Button (I, text="login", the command=o). The grid (row=2, the column=1)
V1 set (" please enter the password: ")
Print (a)
mainloop()
CodePudding user response:
Put a=STR (v2. The get ()) this line into the function O the first line of the can,Print this line to delete (a),
Because the variable a before Entry input to obtain the v2 value is empty,
And click the button to call a function after O, they didn't obtain the V2 action again, so a inside is empty,