def pickColor(self, styleName): colorBtn = getattr(self.ui, styleName + "Color") color = QColorDialog().getColor(colorBtn.color, self, styleName + " Color", QColorDialog.ShowAlphaChannel) if color.isValid(): colorBtn.setColor(color) self.updateDebugDrawValues(styleName)
def choose_color(self): color = QColorDialog().getColor() if color.isValid(): self.button.setStyleSheet(u'background-color:' + color.name()) else: msgbox = QMessageBox() msgbox.setWindowTitle(u'No Color was Selected') msgbox.exec_()
def choose_color(): color = QColorDialog().getColor() msgbox = QMessageBox() if color.isValid(): pixmap = QPixmap(50, 50) pixmap.fill(color) msgbox.setWindowTitle(u'Selected Color') msgbox.setIconPixmap(pixmap) else: msgbox.setWindowTitle(u'No Color was Selected') msgbox.exec_()
def choose_color(): # Select color color = QColorDialog().getColor() # Report about result of selection in QMessageBox dialog msgbox = QMessageBox() if color.isValid(): # Create a memory image 50x50 filled with selected color to display # as a icon in the msgbox dialog pixmap = QPixmap(50, 50) pixmap.fill(color) msgbox.setWindowTitle(u'Selected Color') msgbox.setIconPixmap(pixmap) else: msgbox.setWindowTitle(u'No Color was Selected') msgbox.exec_()
def choose_color(self): color = QColorDialog().getColor() if color.isValid(): self.color = color self.setStyleSheet("border: 1px solid black; background: "+color.name())