samedi 27 mai 2017

Getting values of multiple check boxes corresponding to dynamically generated text in python 3.6

Hi iam trying to create an interface to select the type of request and print the result dynamically. Here is my code and when i tried, it got the values of last sentence but i need the values of checkboxes corresponding to the string

from tkinter import *
import csv
root = Tk()

with open("data.csv", newline = "") as file:
   reader =  csv.DictReader(file)
   c=0
   TestList=[]
   for col in reader:
       var1 = IntVar()
       var2 = IntVar()
       var3 = IntVar()
       var4 = IntVar()
       label = Label(root, width = 10, height = 2,text = col['URL']).grid()
       Checkbutton(root,text="create",variable=var1).grid(row=c,column=1)
       Checkbutton(root,text="see",variable=var2).grid(row=c,column=2)
       Checkbutton(root,text="edit",variable=var3).grid(row=c,column=3)
       Checkbutton(root,text="delete",variable=var4).grid(row=c,column=4)
       c+=1
root.title("Counting Seconds")
label =Label(root, fg="green")
button =Button(root, text='Stop', width=25, command=root.destroy).grid()
root.mainloop()

Any suggestions are welcomed.




Aucun commentaire:

Enregistrer un commentaire