def fill_table(self): # Update accumulated plans yr_current = date.today().year yr_accu = [0, 0] yr_last_1_accu = [0, 0] yr_last_2_accu = [0, 0] for uni in self.university_list: if yr_current in uni.plans: yr_accu[Class_Science_Index] += uni.plans[yr_current][ Class_Science_Index] yr_accu[Class_Art_Index] += uni.plans[yr_current][ Class_Art_Index] uni.update_accumulated_plan(yr_current, yr_accu[Class_Science_Index], yr_accu[Class_Art_Index]) if (yr_current - 1) in uni.plans: yr_last_1_accu[Class_Science_Index] += uni.plans[ yr_current - 1][Class_Science_Index] yr_last_1_accu[Class_Art_Index] += uni.plans[ yr_current - 1][Class_Art_Index] uni.update_accumulated_plan( yr_current - 1, yr_last_1_accu[Class_Science_Index], yr_last_1_accu[Class_Art_Index]) if (yr_current - 2) in uni.plans: yr_last_2_accu[Class_Science_Index] += uni.plans[ yr_current - 2][Class_Science_Index] yr_last_2_accu[Class_Art_Index] += uni.plans[ yr_current - 2][Class_Art_Index] uni.update_accumulated_plan( yr_current - 2, yr_last_2_accu[Class_Science_Index], yr_last_2_accu[Class_Art_Index]) # Filter types for display self.candidates = [] for uni in self.university_list: if ((self.type_985_value.get() and uni.type_985) or (self.type_211_value.get() and uni.type_211) or (self.type_lead_uni_value.get() and uni.type_lead_uni) or (self.type_lead_sub_value.get() and uni.type_lead_sub) or (self.type_others_value.get() and uni.type_985 == 0 and uni.type_211 == 0 and uni.type_lead_uni == 0 and uni.type_lead_sub == 0) or self.type_all_value.get()): self.candidates.append(uni) print "Side of candidates: ", len(self.candidates) self.candidates.sort(key=lambda x: x.rank) print "update display based on class and types" data = { 'rec1': { 'col1': 99.88, 'col2': 108.79, 'label': 'rec1' }, 'rec2': { 'col1': 99.88, 'col2': 108.79, 'label': 'rec2' } } model = TableModel(rows=20, columns=10) table = TableCanvas(self.table_list, model=model) table.pack(fill=Tk.BOTH, expand=True) table.cellbackgr = "white" table.selectedcolor = 'green' table.createTableFrame() model = table.model model.importDict( data) # can import from a dictionary to populate model table.redrawTable() '''rows = len(self.candidates) + 1