Q:

capturing tkinter checkbox input

I am running a script with tkinter that captures user input and then opens a second and possibly a third window based on the input.  The issue I am having is capturing user input from the third and final window.  Each window is divided up into it's own python class on execution. 
Here is the code that calls the third window, which executes properly:
test_assign = TestAssign(mylist)

Here is the third window code:
class TestAssign:
    def __init__(self, mylist):
        self.mylist = mylist
        self.selected_values = []
        self.master = Tk()
        for i in range(len(mylist)):
             setattr(self, 'item'+mylist[i], IntVar())
             ch = Checkbutton(master, text='item'+mylist[i], variable=getattr(self, 'item'+mylist[i])
             ch.pack()
        b = Button(master, text='Next', command=self.get_selected_values)
        b.pack()

        mainloop()

    def get_selected_values(self):
        for i in range(len(self.mylist)):
            if getattr(self, 'item'+self.mylist[i]) == 1:
                self.selected_values.append(self.mylist[i])
        self.master.destroy()

Control then returns to the call point (at least I believe it does).  Where I attempt to print the selected values:
test_assign = TestAssign(mylist)
while not test_assign.selected_values:
    pass
print test_assign.selected_values

Everytime execution gets to the print statement it prints an empty list whether there are boxes checked or not.  If I call dir(test_assign) for testing purposes, the checkbox attrs are there.  Not sure why I am not able to capture it like this. 
Can anyone see the flaw in my code? 

A:

Two things:
1)
ch = Checkbutton(master, text='item'+mylist[i], variable=getattr(self, 'item'+mylist[i])

and
b = Button(master, text='Next', command=self.get_selected_values)

I think master should be self.master (but honestly, that almost certainly just a copy/pasting error.) 
2) The important one:
if getattr(self, 'item'+self.mylist[i]) == 1:

should be
if getattr(self, 'item'+self.mylist[i]).get() == 1:

(you need to call get on your IntVars to read the value.)