pythongtkgtkentry

Python Gtk.Entry placeholder text


i have a login-window with two gtk.Entry objects, one for username, one for password. How can i add some Ghosttext to the Entry, so there is written "Username" in the Entry but if you click inside the text dissapears.


Solution

  • Starting with Gtk+ 3.2 it's possible to set placeholder text.

    entry = Gtk.Entry()
    entry.set_placeholder_text("I am a placeholder")