0
我已經做了一個小程序,應該問你的密碼和用戶名。輸入您的詳細資料後,應檢查密碼和用戶名是否正確。我如何接近並做到這一點?檢查Python中的密碼和用戶名輸入是否匹配?
from tkinter import *
from getpass import getpass
def callback():
print(E1)()
top = Tk()
L1 = Label(top, text="User Name")
L1.grid(row=0, column=0)
E1 = Entry(top, bd = 5)
E1.grid(row=0, column=1)
L1 = Label(top, text="Password")
L1.grid(row=1, column=0)
E1 = Entry(top, bd = 5,show="•")
E1.grid(row=1, column=1)
MyButton1 = Button(top, text="Submit", width=10, command=callback)
MyButton1.grid(row=3, column=1)
top.mainloop()
您正在導入getpass模塊,但您沒有使用它。你想知道如何使用它,或者你想使用自己的Tk代碼嗎? – jedwards
那麼,你在哪裏和以什麼形式存儲正確的密碼或正確的密碼哈希?您需要某種方式從程序中訪問這些信息。 –
是的,我想知道如何使用getpass,我正在考慮在代碼中存儲密碼和用戶名。 – EatMyApples