So I’m trying to write a group of checkboxes (I actually should probably write it as a class, because it is very possible we’ll add additional ones)
So far I’ve got this, but this repeats code and so isn’t very efficient. In what ways can I make the code more elegant?
var1 = IntVar()
var2 = IntVar()
var3 = IntVar()
c1 = Checkbutton(text="Snagit", variable=var1)
c1.pack()
c2 = Checkbutton(text="Camtasia", variable=var2)
c2.pack()
c3 = Checkbutton(text="GotoMeeting", variable=var3)
c3.pack()
app.mainloop()
check1 = var1.get()
check2 = var2.get()
check3 = var3.get()
Here’s a quick example of how to use a loop to make this a little better: