def decryptHandler(pwd): if not unlocked: gpwd = decryptPwdE.get() if gpwd != "": if ap.checkPassword(gpwd) == True: detailsGapL2.config( text= '\nPassword decrypted.\nClose the window to encrypt it.\n', fg='green') decryptPwdBtn.grid_remove() decryptPwdE.grid_remove() decryptPwdT.grid_remove() pwdTL.config(text=al.decrypt(pwd)) loginPwdBtn = Button(detailsWindow, text='Copy Password', command=lambda key=pwd: copy_button(key)) loginPwdBtn.grid(row=6, column=5, columnspan=4, sticky=E) else: detailsGapL2.config(text='\nIncorrect global password.\n', fg='red') else: detailsGapL2.config(text='\nPlease enter your global password.\n', fg='red') else: detailsGapL2.config( text='\nPassword decrypted.\nClose the window to encrypt it.\n', fg='green') pwdTL.config(text=al.decrypt(pwd)) decryptPwdBtn.grid_remove()
def copy_button(pwd): clip = Tk() clip.withdraw() clip.clipboard_clear() clip.clipboard_append(al.decrypt(pwd)) clip.destroy()