Why doesn't my tkinter callback return a password?
In this line:
generate_password_button = Button(right_frame, text="Generer", font=("Helvetica", 30), bg='#4065A4', fg="#4065A4", command=generate_password())
you assign generate_password()
as the command to be executed when the button is pressed. The effect of this is to use the return value of generate_password()
as the command to be executed, which is None
as it doesn't explicitly return anything, and nothing will happen.
Instead, you want to pass the function itself, without calling it, i.e.:
generate_password_button = Button(right_frame, text="Generer", font=("Helvetica", 30), bg='#4065A4', fg="#4065A4", command=generate_password)
Now, when your button is pressed, the generate_password
function (callback) will be called.