0

I don't know If I was able to explain what I want to do.

I want to add a text inside a entry that shows what is this entry for.

For example a gray "Password" text inside a password entry. That must disappear when user starts writing a password.

I am using Python 3.8.8 and tkinter.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Yılmaz Alpaslan
  • 327
  • 3
  • 16

1 Answers1

1

If you're beginning with Python and GUI interfaces, you should definitly have a look at PySimpleGUI which a is VERY easy to use wrapper for tkinter and Qt. Also works for web applications with PySimpleGUIWeb.

Install the package with python -m pip install pysimplegui then try the following example:

import PySimpleGUI.PySimpleGUI as sg

layout = [[sg.Text('My one-shot window.')],
                 [sg.InputText(key='-IN-', password_char='*')],
                 [sg.Submit(), sg.Cancel()]]

window = sg.Window('Window Title', layout)

event, values = window.read()
window.close()

text_input = values['-IN-']
sg.popup('You entered', text_input)

Checkout the result: Result

Orsiris de Jong
  • 2,819
  • 1
  • 26
  • 48
  • Just as questions seeking tool recommendations are off topic for Stack Overflow, "try using this different tool rather than the one you want help with" is generally not a good answer - at least not without a clear argument as to why the chosen tool is not fit for purpose. – Karl Knechtel Mar 30 '21 at 23:15
  • Look at 1st edition of the question which didn't even state Tkinter, so my answer wasn't off topic in the first place. Also, the tool I suggest still is a wrapper for Tkinter ;) – Orsiris de Jong Mar 30 '21 at 23:18