我想在程序中做一個小日誌。但是我不確定是否有辦法在輸入密碼時用星號代替「密碼」。這是我的代碼:在python中隱藏密碼輸入
from tkinter import *
def callback():
print("hi")
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)
E1.grid(row=1, column=1)
MyButton1 = Button(top, text="Submit", width=10, command=callback)
MyButton1.grid(row=3, column=1)
top.mainloop()
這比我想象的要容易得多。非常感謝 – EatMyApples