def _setupCategories(self, config): """Add buttons to browse between categories config -- ConfigParser containing application settings """ #Get all button data lines = [] ctr = 1 option = ini.image + str(ctr) while(config.has_option(ini.year, option)): line = config.get(ini.year, option) lines.append(line) ctr += 1 option = ini.image + str(ctr) #Create as many buttons as needed buttondata = zip(lines, self._years) if(len(buttondata) < len(self._years)): print('Warning! There are more categories than category buttons - some categories will not be shown') ctr = 0 for (line, year) in buttondata: tb = TransparentButton(self._canvas, self._settings.generalfont, line, self._scalefactor) tb.setText(year) tb.setCommand(self._ehYear) tb.index = ctr ctr += 1 self._activeInPreview.append(tb)