python中字符串比较的问题的问题
以下代码是Tk做了一个简单的密码验证功能,输入一个字符串,并验证其是否正确,请先看代码:
from tkinter import *root = Tk()e = StringVar()t = 'cashlu'def yanzheng(): if e == t: e.set('Good!') else: e.set('Wrong!')entry = Entry(root, textvariable = e)button = Button(root, text = 'OK', command = yanzheng)entry.pack()button.pack()root.mainloop()