在python中隐藏密码输入 [英] Hiding password entry input in python
本文介绍了在python中隐藏密码输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试制作一个小登录程序.但我不确定当你输入密码时是否有办法用星号替换密码".这是我的代码:
I am trying to make a little log in program. But i am not sure if there is a way to replace the "password" with stars when you type the password. This is my code:
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()
推荐答案
使用 show="*"
选项.例如
E1 = Entry(top, bd = 5, show="*")
这篇关于在python中隐藏密码输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文