Reputation: 608
I want to add a simple password check to a Python/wxPython/MySQL application to confirm that the user wants to carry out a particular action. So far I have a DialogBox with a textCtrl for password input and Buttons for Submit or Cancel. At the moment the password appears in the textCtrl. I would prefer this to appear as asterisks whilst the user input is captured but cannot figure out how to do this. How could I implement this?
Upvotes: 0
Views: 633
Reputation: 22443
I'd probably run with the answer Yoriz gave but there is a wx.dialog
that you can use:
passwd = wx.PasswordEntryDialog(None, "Whats the password", 'Password','',style=wx.TextEntryDialogStyle)
ans = passwd.ShowModal()
if ans == wx.ID_OK:
entered_password = passwd.GetValue()
else:
entered_password = False
print "password ", entered_password
passwd.Destroy()
Upvotes: 1
Reputation: 3625
Set the style on the text ctrl as TE_PASSWORD: The text will be echoed as asterisks.
Upvotes: 2