I have a tkinter application I am working on which has button which when pressed fires a function. I also have about 7 checkboxs which when checked changes its own variable from 0 to 1.
In the function I have a bunch of if statements that goes through every combination of the checkboxes and performs and action. The issue is because the checkbox can have two states, off (0) and on (1) with 7 checkboxes - if we do 2 to the power of 7 to work out every single combination, that is 128 if statements I will need to write out.
I have also thought about writing 7 if statement to check each state of each checkbox then moving onto the next one but because I need to loop through a 2 lists and perform different actions, it's hard to log what is happening at each stage without duplication of logs or the detail I need.
Is there a better way of doing this?
Any help would be great, thanks!
Aucun commentaire:
Enregistrer un commentaire