I'm attempting to populate a list of results (in this example from a python list) and give each result it's own checkbutton. That works with the variable=Variable() piece in the TK button code, though i'm not exactly sure how it works.. When the results are generated I need to be able to select them and then delete the selected ones. I'm looking for help to get the state of each check box so I can delete that entry. Here is the code I have so far.
from tkinter import *
root = Tk()
root.title("DB Sandbox")
root.geometry("400x400")
def del_selected():
pass
results = ['one', 'two', 'three', 'four']
for result in results:
l = Checkbutton(root, text=result, variable=Variable())
l.pack()
delbutt = Button(root, text="Delete Selected", command=del_selected)
delbutt.pack(pady=10)
root.mainloop()
Any direction on this is much appreciated!
Aucun commentaire:
Enregistrer un commentaire