import string
from random import randint, choice
from tkinter import *
def generate_password():
password_min = 6
password_max = 12
all_chars = string.ascii_letters + string.punctuation + string.digits
password = "".join(choice(all_chars) for x in range(randint(password_min, password_max)))
password_input.delete(0, END)
password_input.insert(0, password)
window = Tk()
window.title("Henerateur de mot de passe")
window.geometry("720x480")
window.config(background='#4065A4')
frame = Frame(window, bg='#4065A4')
width = 300
height = 300
image = PhotoImage(file="password.png").zoom(35).subsample(32)
canvas = Canvas(frame, width=width, height=height, bg='#4065A4', bd=0, highlightthickness=0)
canvas.create_image(width / 2, height / 2, image=image)
canvas.grid(row=0, column=0, sticky=W)
right_frame = Frame(frame, bg='#4065A4')
label_title = Label(right_frame, text="Mot de passe", font=("Helvetica", 30), bg='#4065A4', fg="white")
label_title.pack()
password_input = Entry(right_frame, text="Mot de passe", font=("Helvetica", 30), bg='#4065A4', fg="white")
password_input.pack()
generate_password_button = Button(right_frame, text="Generer", font=("Helvetica", 30), bg='#4065A4', fg="#4065A4", command=generate_password())
generate_password_button.pack(fill=X)
right_frame.grid(row=0, column=1, sticky=W)
frame.pack(expand=YES)
window.mainloop()
Что должно произойти, это то, что новая случайная серия букв, цифр и знаков пунктуации появляется каждый раз, когда вы нажимаете generate_password_button
; однако при нажатии ничего не происходит.