def addCategory(self): pop=Popup(self.sender().text(),unicode(self.catList.currentText())) if pop.exec_(): newCat=pop.getNewCategory() self.cats.append(newCat) self.catList.addItem(newCat) self.catList.setCurrentIndex(self.catLen) self.catLen+=1