import PySimpleGUI as sg
if __name__ == '__main__':
layout = [
[sg.InputText('123456', password_char='*', key='pwd_input'), sg.Button('显示', key='show_pwd')]
]
window = sg.Window('密码框', layout)
flag = True
while True:
event, values = window.read()
if event in 'show_pwd':
if flag:
window.find_element('show_pwd').update('隐藏')
window.find_element('pwd_input').update(password_char='')
flag = False
else:
window.find_element('show_pwd').update('显示')
window.find_element('pwd_input').update(password_char='*')
flag = True
pysimplegui部分源码
它报关键字不匹对,查看pysimplegui的源码属性是PasswordCharacter但试了还是没用,求大神指导,困扰我好久了