English 中文(简体)
密码抄录的核对
原标题:Check off which password to copy

因此,我正在利用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)
问题回答

Description: I also made a program in which I needed to import and copy a key and use it elsewhere in the Operating System. In that situation I found a library named pyperclip.

<><>><>>Usage:<>/strong>

我在我的节目中用纸张照相机复制录入箱子内的测试。

pyperclip.copy(entrybox_2.get( 0,0 ,  end )
# Where entrybox_2 is an entrybox widget of tkinter

Example: So if U want to utilize pyperclips functionality:

import pyperclip

pyperclip.copy()
# Inside of the .copy() function add .get() function to retrive the password string

Additional Info: As a member of the stackoverflow community try to be descriptive and also add some example code with your issue so that the issue can be solved easily.

您可使用每个记录单上的“Radiobutton> 编号/编号”,并抄录所选编号的编号。

def find_details():
    entered_platform = platform_entry.get().lower()

    cursor.execute( SELECT * FROM MyUsers WHERE platform=? , (entered_platform,))
    users = cursor.fetchall()

    if users:
        info_box_window = tk.Toplevel(root)
        info_box_window.geometry("320x390+620+300")
        info_box_window.title("User found")

        tk.Label(info_box_window, text="Users Found:").pack()

        passwd_var = tk.StringVar() # tkinter variable for radio buttons
        for user in users:
            decrypted_username = decrypt_data(user[1], key)
            decrypted_password = decrypt_data(user[2], key)
            platform = user[3]
            # create radiobutton for this record
            info_message = f"Username: {decrypted_username}
Password: {decrypted_password}
Platform: {platform}
{ = *20}"
            tk.Radiobutton(info_box_window, text=info_message, justify="left",
                           variable=passwd_var, value=decrypted_password).pack()

        passwd_var.set(decrypted_password) # select the last one initially

        def copy_to_clipboard():
            password = passwd_var.get()
            print(password)
            pyperclip.copy(password)

        copy_info_button = tk.Button(info_box_window, text="Copy password to clipboard", command=copy_to_clipboard)
        copy_info_button.pack(pady=10)




相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签