Unfortunately, the show attribute of the Entry widget does not work this way: as you noticed, it simply indicates one character to display instead of what was printed.
To get the desired effect, you need to intercept keystrokes on the Entry widget and then translate them. However, you should be careful not only to mutate the keys that you really want and leave others (in particular, βReturnβ, βDeleteβ, arrow keys, etc.). We can do this by attaching a callback to all keypress events in the input field:
self.Password.bind("<Key>", callback)
where callback() is defined to call your random function, if it is the letter ascii (which means the numbers go through unmodified ones), insert a random character, and then return the special string constant break to indicate that processing no longer needs this event happen):
def callback(event): if event.char in string.ascii_letters: event.widget.insert(END, random_char()) return "break"
source share