Tkinker Python Tutorial

from Tkinter  import *
     
class Checkbar(Frame):
    def __init__(self, parent=None, picks=[], side=LEFT, anchor=W):
        Frame.__init__(self, parent)
        self.vars = []
        for pick in picks:
            var = IntVar()
            chk = Checkbutton(self, text=pick, variable=var)
            chk.pack(side=side, anchor=anchor, expand=YES)
            self.vars.append(var)
    def state(self):
        return [var.get() for var in self.vars]  
root = Tk()
checkBoxBar = Checkbar(root, ['A', 'B', 'C', 'D'])
checkBoxBar.pack(side=TOP,  fill=X)
checkBoxBar.config(relief=GROOVE, bd=2)
def allstates(): 
   print checkBoxBar.state()
Button(root, text='Peek', command=allstates).pack(side=RIGHT)
root.mainloop()