3

I have used gtk.Notebook() in my script, In notebook tab I have given 2 text fields username and password but problem is that the entry field does not behave as password field, it is showing character. so I want if i type password it should be confidential jsut like as (*).

This is code which i have used

    entry = gtk.Entry()
    entry.set_invisible_char("*")
    entry.set_size_request(100, 75)
    entry.show ()

    label = gtk.Label("Add page")
    notebook.insert_page(entry, label, 2)

Now anyone tell me how to do that.

Thanks in advance...

Ashish Jain
  • 760
  • 1
  • 8
  • 23

1 Answers1

3

Gtk Entry documentation:

gtk_entry_set_visibility() sets whether the contents of the entry are visible or not. When visibility is set to FALSE, characters are displayed as the invisible char, and will also appear that way when the text in the entry widget is copied elsewhere.

For python that should be Entry.set_visibility(False).

Also, you don't need to set the invisible character: GTK+ will do it's best to pick a good character for the font in question (typically '*').

Jussi Kukkonen
  • 13,857
  • 1
  • 37
  • 54