Here’s a demo of the text control with hidden password and icon.
Please feel free to improve this widget or create a modified version, and remember that any changes to the source can help the community.
textctrl_password_demo.zip (9.6 KB)
This new widget has been successfully tested on the following platforms:
-
Windows 10/11 | Python 3.11.9 |
-
wxPython 4.2.3 | wxWidgets 3.2.6
-
Linux Mint 21 | Python 3.10.12 |
-
wxPython 4.2.1 gtk3 | wxWidgets 3.2.2.1
-
MacOS Sequoia 15 | Python 3.12.4 |
-
wxPython 4.2.2 | wxWidgets 3.2.6
Regards
1 Like
Thanks. I recently had a need to add an “Admin/Expert” password control to an application. Of course, one of the first comments I got was that it would be nice to have the classic “show/hide” icon. I got as far as finding that toggling wx.TE_PASSWORD was known to not work. So, the example here is very helpful.
If I might suggest some changes,
pw_showhide.py (2.9 KB)
is a little more compact, and allows setting the “side” for the “icon” when creating the control.
This (and several other recent examples) seem like they could be curated somewhere.
I have a motley collection “wx utilities” that I use at GitHub - newville/wxutils: wxPython utilities and convenience functions. This includes some code for passwords (including hashing and checking against that hash, and also enforcing some password rules). I’ll add this “show/hide” feature.
Maybe there should be a better curated collection of common wx utilities that have not made it into the wxPython distribution. Or perhaps a reworking of the standard demos and examples to a separate project to include more examples or utilities like this?
1 Like
Hello Matthew,
Thank you for improving password control and sharing the link to your utilities.
If you’d like to create a GitHub account for the new widgets or add them to your collection, please let us know. I’m sure there are many improvements that could be made.
As Andrea Gavanna suggested, another solution would be to create an equivalent to the “AGW” widgets.
Unfortunately, my knowledge doesn’t allow me to undertake such a step.
“Bis repetita,” if anyone can lead this project for the community, they would be welcome.