lawsie / guizero

A Python 3 library to allow learners to quickly and easily create GUIs.
https://lawsie.github.io/guizero
BSD 3-Clause "New" or "Revised" License
402 stars 81 forks source link

An option in the question dialog to hide the input #487

Closed Usernames-Are-Not-Available closed 11 months ago

Usernames-Are-Not-Available commented 12 months ago

An issue I've had with the question dialog is that there's never been an option to hide the input - i.e. only showing a certain character instead of the actual input - for the dialog. Yet that feature is available on the standard textbox widget.

An alternative for users who need this kind of feature - to, for example, hide a password inputted into a question dialog - would be to create another window with a textbox configured to hide its input, and a pushbutton to return the textbox's value. I've done this before - it's a very drawn-out method of doing a task that could be quite easily implemented.

My solution for this would be going into the files, finding what is called when you start a question dialog, and editing the passable arguments to allow for a user to hide the input of the dialog, and then testing to see if it works without changing the Tk code.

I think that it should be relatively easy to implement - maybe taking the best part of a day, maybe less, to complete (including tests) - and if I can implement it on my copy of guizero, I'd like to open a pull request and see if you all are fine with the changes.

Anyway, just comment on this if you think it'd be a nice to have feature, and if it gets approval, I'll start working on it.

martinohanlon commented 11 months ago

guizero uses the tkinter simpledialog for the question popup.

simpledialog does not support masking (i.e. hiding the input).

My recommendation (as you suggest) would be to create a function which uses the standard guizero components, Window, TestBox, PushButton to create a dialog which is specific for your needs.