How to store tkinter button widgets in a dictionary?
You don't need to use json as you are not working with a JSON object but a python dictionary.
Here is your code refactored to populate the app with 3 buttons;
[UPDATED] Although you will need to completely refactor your code because your for
loop is populating the clipboard with everything in your dictionary immediately.
from tkinter import *from tinydb import TinyDB, Querydb = TinyDB('clipboard.json')root = Tk()root.title("CopyNotes")root.geometry()mynotes = { "B1": ["button1label","button1note"], "B2":["button2label","button2note"], "B3":["button3label","button3note"]}def cp_to_cb_and_db(note, key): root.clipboard_append(note[key][1]) print('[+] Adding note: {} to clipboard.'.format(note)) db.insert({key: note})for key in mynotes: btnz = Button( root, text=mynotes[key][0], font="Helvetica 10 bold", bg="silver", command=cp_to_cb_and_db(mynotes, key), height=2, width=13).pack(side=TOP, fill=BOTH, expand=YES)root.mainloop()