Nov-14-2022, 08:00 PM
Here is another example of a password generator
# Do the imports from random import sample import string import tkinter as tk # Combine upper and lower case letters with digits and special characters # into a string characters = string.ascii_letters + string.digits + '!@#$&*+' # Define the function def password_generator(passwd): # Return a joined string with 10 sample charcters # return ''.join(sample(characters, 10)) passwd['text'] = ''.join(sample(characters, 10)) root = tk.Tk() label = tk.Label(root, text='Password Generater', bg='steelblue', fg='white') label['font'] = ('serif', 18, 'bold') label.pack() passwd = tk.Label(root, bg='antiquewhite', relief='ridge') passwd['font'] = ('serif', 14, 'normal') passwd.pack(expand=True, fill='x', pady=4) button = tk.Button(root, text='Generate Password', command=lambda: password_generator(passwd)) button['font'] = ('comic sans ms', 12, 'bold') button.pack(expand=True, fill='x') root.mainloop()
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags