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 _interactive_color_dialog(callback): from PySide.QtGui import QColorDialog dialog = QColorDialog() dialog.currentColorChanged.connect(callback) dialog.show() return dialog
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 showColorDialog(self): color = QColorDialog.getColor() if not color.isValid(): return rgba = list(color.getRgbF()) self.node.color = [rgba[0], rgba[1], rgba[2]] self.colorButton.setColor(self.node.color) self.nodeUpdated.emit(self.node)
def showColorDialog(self): color = QColorDialog.getColor() if not color.isValid(): return rgba = list(color.getRgbF()) self.colorButton.setColor(rgba[0:3]) self.color = self.colorButton.color self.valueChanged.emit(self.color)
def editorEvent( self, event, model, option, index ): column = GridManagerColumns.Columns[index.column()] # The only situation that we are looking at right now, is when we click at the button in the Color Column. if( (column == GridManagerColumns.Color) and (event.type() == QEvent.MouseButtonRelease) ): button_rect = self._get_color_picker_button_dimensions(option.rect) # If the user click inside the area of the button, we show the QColorDialog and use the color returned =] if( button_rect.contains( event.pos() ) ): self._color = QColorDialog.getColor() # There must be a better way to update the model, however, I found that this workaround works pretty well >.< # I'm still learning this s**t :P self.setModelData( None, model, index ) return super(VoxelGridDelegate, self).editorEvent(event, model, option, index)
def get_color(self): """ Raise a QColorDialog and apply the color to the background color of the button """ dial = QColorDialog() dial.setOptions(QColorDialog.DontUseNativeDialog) res = dial.exec_() if res: rgb = dial.currentColor().red(), dial.currentColor().green( ), dial.currentColor().blue() self.setColor(rgb) rgb = [c / 255.0 for c in rgb] self.colorChanged.emit(rgb)
def get_color(self): """ Raise a QColorDialog and apply the color to the background color of the button """ dial = QColorDialog() dial.setOptions(QColorDialog.DontUseNativeDialog) res = dial.exec_() if res: rgb = dial.currentColor().red(), dial.currentColor().green(), dial.currentColor().blue() self.setColor(rgb) rgb = [c / 255.0 for c in rgb] self.colorChanged.emit(rgb)
def colorChooserClicked(self, textfield): """ QT Slot handles when a color chooser is clicked. Parameter : - textfield : The QLineEdit where to output the name of the choosen color. """ color = textfield.text() colorChooser = QColorDialog(self) if color: colorChooser.setCurrentColor(QColor(color)) if colorChooser.exec_(): ret = colorChooser.currentColor() if ret is not None and ret.isValid(): color = ret.name() self.updateColorField(textfield, color)
def on_button_clicked(self): """Respond to button clicked event (callback).""" color = QColorDialog.getColor(initial=self.color) if color.isValid(): self.color = color self._set_icon(color)
def chooseColor(self, button, option): """The user modifies an UI background color.""" color = QColorDialog.getColor() if color.isValid(): button.setPalette(QPalette(color)) self.config.set('Appearance', option, color.name())
def choose_color(self): color = QColorDialog().getColor() if color.isValid(): self.color = color self.setStyleSheet("border: 1px solid black; background: "+color.name())
def change_line_color(self,color=None): if color==None:color=QColorDialog.getColor() if color.isValid(): self.curve.setPen(color)
def change_line_color(self): color = QColorDialog.getColor() if color.isValid(): self.linecolor = color
def change_point_color(self): color = QColorDialog.getColor() if color.isValid(): self.pointcolor = color
def change_point_color(self,color=None): if color==None:color=QColorDialog.getColor() if color.isValid(): self.curve.setSymbolBrush(color)
def changeColor(self, row, column): if column == 1: col = QColorDialog.getColor() parametricPulseGraph.COLOR_MAP[self.window.categoryTable.item(row,0).text()] = col self.window.categoryTable.item(row,1).setBackground(col) self.multiPanel.scene.update()