[Tutor] Select and deselect for multiple checkboxes in Tkinter
Alan Gauld
alan.gauld at yahoo.co.uk
Fri Feb 17 20:23:08 EST 2017
On 17/02/17 18:31, Pooja Bhalode wrote:
> I am writing to create two buttons, for selecting and de-selecting multiple
> checkboxes that I have created previously. These checkboxes have different
> variables that they are associated with for their values and thus cannot
> create a loop for the same.
You can still use a loop by putting the variables in
a list/tuple:
checkboxVars = [keqparam,delHrxnparam,kfparam,Afparam....,RCparam]
for var in checkboxVars:
var = 0 #or whatever.
You can even use different reset values if necessary
by putting them in tuples:
checkboxVars = [(keqparam,0),(delHrxnparam,1),
(kfparam,2),(Afparam....,
...(RCparam,42)]
for var,val in checkboxVars:
var = val #or whatever.
HTH
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list