def callback(): color = col if color == "Custom": color = QtGui.QColorDialog.getColor() if color.isValid(): for event in self.events: if self.background == event.priority: event.priority = color event.eventLabel.setStyleSheet("QWidget { background-color: % s }" % color.name()) self.background = color self.repaint() JSONfunctions.update_background(self, color, NotesOnDisplay, NotesOnDisplayJSON) JSONfunctions.convert_all_events(self, NotesOnDisplay, NotesOnDisplayJSON) JSONfunctions.save(NotesOnDisplayJSON, SIZE, FONTSIZE) self.setColorChecked()