Badges
Activity Feed
Replied to thread : (Python) Password Generator
I recommend to use pyperclip module to copy the password when you have clicked the password generator, it will get easier if you want to write a password.
import string
import random
import pyperclip #We imported pyperclip module
from tkinter import *
window = Tk()
def generate ():
charecter = string.ascii_letters
password = []
for i in range(10): # Lenght
randomchar = random.choice(charecter)
password.append(randomchar)
pyperclip.copy(''.join(password)) #We have used the one of methods pyperclip (copy method)
lbl.destroy()
lbl2=Label(window, text="Your Password is " + "".join(password))
lbl3=Label(window, text="You have copied the password! :D", fg='blue')
lbl3.place(x=60, y=70)
lbl2.place(x=65, y=50)
lbl=Label(window, text="Your Password will appear here", fg='red')
lbl.place(x=62, y=50)
btn=Button(window, text="Generate Password", fg='blue', command=generate)
btn.place(x=90, y=100)
window.title("Password Generator")
window.geometry("300x230")
window.mainloop()