Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'd like a user to be able to insert a username/password in a small Gtk-perl app, but of course I don't want the pass displayed. In HTML forms, you can specify when something input will be a password, and it's shown as "***" on the screen. Is there such a thing ready-made for Gtk-perl? I've checked out the tutorial at gtkperl.org, but no luck in my quest....

Replies are listed 'Best First'.
Re: Password widget for Gtk-Perl?
by Rich36 (Chaplain) on May 29, 2002 at 15:50 UTC

    I think you have to set a property on the Entry widget to hide the text - similiar to -show => '*' for Perl/Tk (Entry widget). This code might make it so that the characters being typed are not visible.

    $entry->set_visibility ($visibility);

    Where $visibility is a boolean value.

    Here's some info from http://www.gnome.org/~james/pygtk-docs/class-gtkentry.html - a page on gtk.

    gtk.Entry.set_invisible_char instance.set_invisible_char(ch); ch a Unicode character Sets the character to use in place of the actual text when gtk.En +try.set_visibility() has been called to set text visibility to FALSE. + i.e. this is the character used in "password mode" to show the user +how many characters have been typed. The default invisible char is an + asterisk ('*'). If you set the invisible char to 0, then the user wi +ll get no feedback at all; there will be no text on the screen as the +y type.

    I didn't see any Perl/gtk calls to set_invisible_char, but it doesn't mean it doesn't exist.


    Rich36
    There's more than one way to screw it up...

      That's it exactly! A million times I read it, and never seemed to see it. Funny how that happens....

      Muchas gracias ^_^