Write python GUI program to generate a random password with upper and lower case letters.
import string
from secrets import choice
from tkinter.constants import END
UPPERCASE = list(string.ascii_uppercase)
LOWERCASE = list(string.ascii_lowercase)
from tkinter import *
#chars =
string.ascii_letters + string.digits + string.punctuation
chars = string.ascii_letters
random.seed =
(os.urandom(1024))
random_str =
''.join(random.choice(chars) for _ in range(max_chars))
return random_str
def update_random_string():
try:
count_chars =
int(pass_len.get())
except ValueError:
return
pass_box.delete(0,
'end')
pass_box.insert(0,
get_random_string(count_chars))
pass_box.config(state="readonly")
pass_len.insert(0, '10')
pass_len.grid(row=0, column=1)
btn['command'] = lambda: update_random_string()
btn.grid(row=0, column=2, rowspan=1, padx=10, ipadx=10)
pass_box = Entry(frame)
pass_box.grid(row=1, column=1)
mainWindow.mainloop()