Home > other >  About python tkinter module display password function
About python tkinter module display password function

Time:12-17

Just learn tkinter, want to complete the functions as follows: want to check with checkbutton component show the password after let * shows the original password, check the number and then back to no. *, but the use of function, type of StringVar appearVar variable cannot carry None, so to show the password after all * into 1, a great god opine,



# code label and entry label
Tk. Label (window, text='password:'). The place (x=120, y=140)
Var_user_pwd=tk. StringVar ()
Enter_user_pwd=tk. Entry (window, textvariable=var_user_pwd, show='*')
Enter_user_pwd. Place (x=160, y=140)

AppearVar=tk. StringVar ()
AppearVar. Set (' * ')

Def change_show () :
Enter_user_pwd. Config (show=(appearVar. The get ())

# show the password
Bt_appear=tk. Checkbutton (window, text='show the password, variable=appearVar, onvalue=https://bbs.csdn.net/topics/None, offvalue=' * ', the command=change_show)
Bt_appear. Place (x=310, y=137)
  • Related