因此,我正在利用Tkinter和Kallite建立一个简单的全球调查方案,以便我能够进入细节,自动获得安全密码,检索存储和删除数据。
When i add a user (or an account of mine) to the database, i put in the username i have chosen, the platform and the password gets automatically generated. When i retrieve the data i have stored, i have an "copy password" button, because it is not possible to copy from the Tkinter window. My problem now is, when i add two users on the same website (which is of course a realistic situation) and then want to retrieve the data, two users pop up (which is fine), but the "copy password" button only copies the password of the last user that pops up.
任何想法?
因此,我有使用检查箱的想法,这样一来,我就能够核对希望复制的密码,但我很难提出该守则。
首先是如何找到用户的守则:
def find_detalis():
entered_platform = platform_entry.get().lower()
cursor.execute( SELECT * FROM MyUsers WHERE platform=? , (entered_platform,))
users = cursor.fetchall()
if users:
info_message = "Users Found:
"
for user in users:
decrypted_username = decrypt_data(user[1], key)
decrypted_password = decrypt_data(user[2], key)
platform = user[3]
info_message += f"
Username: {decrypted_username}
Password: {decrypted_password}
Platform: {platform}
{ = *20}"
info_box_window = tk.Toplevel(root)
info_box_window.geometry("320x390+620+300")
info_box_window.title("User found")
label = tk.Label(info_box_window, text=info_message)
label.pack(pady=10)
def copy_to_clipboard():
pyperclip.copy(decrypted_password)
copy_info_button = tk.Button(info_box_window, text="Copy password to clipboard", command=copy_to_clipboard)
copy_info_button.pack(pady=10)