I'm making a part of my program that contains checkboxes. There are a total of 8 checkboxes and the user can set a min and max of 3 of the boxes. This would be simple enough to determine how many are ticked by setting the on-value as 1, and add the total on-values among all the checkboxes, and if its not equal to 3, it'll say so.
However, I store specific information within these checkboxes, and I .get() these and add them to a list which I then put into a treeview and mysql database.
One way I thought I could go around this is by setting the offvalue to 1, and adding all the offvalues, and if the total offvalue is = 5, that means 5 boxes are not checked, hence 3 have been checked. However, I do not know a way to get both the offvalue and onvalue from a check box.
Any help would be appreciated.
var1 = IntVar()
musiccheck = Checkbutton(frame2, text='Music', variable = var1, onvalue='3', offvalue='1')
musiccheck.pack()
var2 = IntVar()
ecocheck = Checkbutton(frame2, text='Econ', variable = var2, onvalue='5', offvalue='1')
ecocheck.pack()