def getNewButtonLabel(self): ''' Requests a new button label from the user. Returns None if user canceled out, or a string with the new button label. @return: None if user canceled, else string from input field. @rtype: {None | string} ''' prompt = "New label for this button:"; dialogBox = QInputDialog(parent=self); dialogBox.setStyleSheet(SpeakEasyGUI.stylesheetAppBG); dialogBox.setLabelText(prompt); dialogBox.setCancelButtonText("Keep existing label"); userChoice = dialogBox.exec_(); if userChoice == QDialog.Accepted: return dialogBox.textValue(); else: return None;