I am trying to create an basic email client for fun. I thought that it would be interesting if the password box would show random characters. I already have a function for creating random characters:
import string
import random
def random_char():
ascii = string.ascii_letters
total = len(string.ascii_letters)
char_select = random.randrange(total)
char_choice = char_set[char_select]
return char_choice
but the issue is that this is only run once, and then the program repeats that character indefinitely.
self.Password = Entry (self, show = lambda: random_char())
self.Password.grid(row = 1, column = 1)
How would I get the Entry widget to re-run the function each time a character is entered?