[Tutor] Select and deselect for multiple checkboxes in Tkinter

Pooja Bhalode poojabhalode11 at gmail.com
Sat Feb 18 09:34:21 EST 2017


Hi Alan,

Thank you for your input. That was an easy fix to it.
Thanks a lot.

Pooja

On Fri, Feb 17, 2017 at 8:23 PM, Alan Gauld via Tutor <tutor at python.org>
wrote:

> 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
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list