mercredi 10 février 2021

How to sum multiple column data using checkbox in tkinter GUI

Currently I am building a tkinter GUI. I am stuck in the following problem: I need to sum the columns of dataset row wise( for example column 1+column 2+column 3=new column) using tkinter checkbox option. I need help understanding how to sum the column data by selecting columns using checkbox. My code is given below :

def check():
    global feat
    feat_names = list(data2.columns)
    checkboxes = []
    for i in range(len(feat_names)):
        feat = tk.StringVar()
        check_box = tk.Checkbutton(root, text=feat_names[i], variable=feat, state ='normal')
        checkboxes.append(check_box)
        check_box.grid(column=5, row=i+2, sticky=tk.W)         
        check_box.deselect()
    return feat
Data:
D1   D2   D3
1     0    0
6   -17    1
17  -24   10
29  -34   30
40  -47   91
52  -62  165
67  -77  224
81  -90  289
95 -104  354



Aucun commentaire:

Enregistrer un commentaire