0

I'm wondering if it's possible to hide characters in a label by replacing them with, for example, an asterisk, like you can in an entry field:

A6 = Entry(W_Menu, show = "*", bd = 3)

Would it be possible to, for example, use a check button to show characters when selected and replace them with an asterisk when unchecked if the text is in a label? This would be very useful for me. If not, are there any alternatives that do not require an entry field?

user3112327
  • 275
  • 3
  • 6
  • 14

2 Answers2

1

Hope this minimal example gives you an idea of what you can do with labels and texts monitoring the status of the checkbox and linking that status to a string variable.
Of course, you can implement the same with a TextLabel controled by the Checkbox status.

from Tkinter import Tk, Checkbutton
from Tkinter import StringVar, IntVar

root = Tk()

name = 'hello'
text = StringVar()
text.set(name)

status = IntVar()

def change():
    # you must implement here the mechanism of change
    # but this serves to show the idea
    if status.get() == 1:   # if clicked
        text.set('****')
    else:
        text.set(name)

cb = Checkbutton(root, textvariable=text, variable=status, command=change)
cb.pack()

root.mainloop()

enter image description here

joaquin
  • 82,968
  • 29
  • 138
  • 152
0

No, there is no such option for labels.

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685