当前位置: 首页>>代码示例>>Python>>正文


Python QtWidgets.QColorDialog类代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QColorDialog的典型用法代码示例。如果您正苦于以下问题:Python QColorDialog类的具体用法?Python QColorDialog怎么用?Python QColorDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QColorDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: change_preview_background

    def change_preview_background(self):
        qcolor = QColorDialog().getColor(QColor(self.preview_bg),
                                         self.window)

        if qcolor.isValid():
            self.preview_bg = qcolor.name()
            self.update_player_preview()
开发者ID:Flagowy,项目名称:starcheat,代码行数:7,代码来源:mainwindow.py

示例2: on_bTest_clicked

    def on_bTest_clicked(self):
        """
        Private method to test the selected options.
        """
        if self.rColor.isChecked():
            if not self.eColor.currentText():
                QColorDialog.getColor()
            else:
                coStr = self.eColor.currentText()
                if coStr.startswith("#"):
                    coStr = "QColor('{0}')".format(coStr)
                else:
                    coStr = "QColor({0})".format(coStr)
                try:
                    exec(
                        "from PyQt5.QtCore import Qt;"
                        ' QColorDialog.getColor({0}, None, "{1}")'.format(coStr, self.eTitle.text())
                    )
                except:
                    E5MessageBox.critical(
                        self,
                        self.tr("QColorDialog Wizard Error"),
                        self.tr("""<p>The colour <b>{0}</b> is not valid.</p>""").format(coStr),
                    )

        elif self.rRGBA.isChecked():
            QColorDialog.getColor(
                QColor(self.sRed.value(), self.sGreen.value(), self.sBlue.value(), self.sAlpha.value()),
                None,
                self.eTitle.text(),
                QColorDialog.ColorDialogOptions(QColorDialog.ShowAlphaChannel),
            )
开发者ID:chiamingyen,项目名称:kmol2016,代码行数:32,代码来源:ColorDialogWizardDialog.py

示例3: changeColor

    def changeColor(self):
        # try:
        
        if self.sender() == self.colormode.ui.comboBoxFGColor:
            color_str = self.colormode.ui.comboBoxFGColor.currentText()
            if color_str == 'CUSTOM':
                color = _QColorDialog.getColor().getRgb()
                color = [round(color[0]/255,2), round(color[1]/255,2), round(color[2]/255,2)]

                self.data.colormap = color

            else:
                self.data.colormap = _mpl.colors.colorConverter.to_rgb(_mpl.colors.cnames[color_str])

        elif self.sender() == self.colormode.ui.comboBoxBGColor:
            bgcolor_str = self.colormode.ui.comboBoxBGColor.currentText()
            if bgcolor_str == 'CUSTOM':
                bgcolor = _QColorDialog.getColor().getRgb()
                bgcolor = [round(bgcolor[0]/255,2), round(bgcolor[1]/255,2), round(bgcolor[2]/255,2)]

                self.data.bgcolor = bgcolor

            else:
                self.data.bgcolor = _mpl.colors.colorConverter.to_rgb(_mpl.colors.cnames[bgcolor_str])
        
        self.createImg(img = self.data.image, xunits = self.data.xunits,
                                yunits = self.data.yunits,
                                extent = self.data.winextent)
        self.mpl.draw()
开发者ID:CCampJr,项目名称:crikit2,代码行数:29,代码来源:widget_images.py

示例4: tableWidgetCellDoubleClicked

    def tableWidgetCellDoubleClicked(self, row, column):
        if column==1:
            self.selected_row = row
            selected_item = self.tableWidget.item(self.selected_row, 1)

            color_dialog = QColorDialog(selected_item.data(Qt.BackgroundRole), self)
            color_dialog.currentColorChanged.connect(self.currentColorChanged)
            color_dialog.open()
开发者ID:Licht-T,项目名称:UMATracker-Area51,代码行数:8,代码来源:color_selector_dialog.py

示例5: _show_color_dialog

def _show_color_dialog(current_color, parent):
    dialog = QColorDialog()
    for idx, color in enumerate(DEFAULT_COLORS):
        dialog.setCustomColor(idx, color)

    current_color = dialog.getColor(current_color, parent, 'Select line color')
    if current_color.isValid():
        return current_color
开发者ID:learningendless,项目名称:gui_tool,代码行数:8,代码来源:value_extractor_views.py

示例6: edit_color

 def edit_color(self):
     row = self.ui.colors.currentRow()
     column = self.ui.colors.currentColumn()
     old_color = self.ui.colors.currentItem().text()
     qcolor = QColorDialog().getColor(QColor("#"+old_color), self.dialog)
     if qcolor.isValid():
         new_color = qcolor.name()[1:].lower()
         self.ui.colors.setItem(row, column, ColorItem(new_color))
开发者ID:Septarius,项目名称:starcheat,代码行数:8,代码来源:appearance.py

示例7: pickColor

 def pickColor(self):
     if self._readOnly:
         return
     dialog = QColorDialog(self._color)
     dialog.setOptions(QColorDialog.ShowAlphaChannel)
     ok = dialog.exec_()
     if ok:
         self.setColor(dialog.currentColor())
         self.colorChanged.emit()
开发者ID:davelab6,项目名称:trufont,代码行数:9,代码来源:colorWidgets.py

示例8: mouseDoubleClickEvent

 def mouseDoubleClickEvent(self, event):
     if self._readOnly:
         return
     dialog = QColorDialog(self._color)
     dialog.setOptions(QColorDialog.ShowAlphaChannel)
     ok = dialog.exec_()
     if ok:
         self.setColor(dialog.currentColor())
         self.colorChanged.emit()
开发者ID:pathumego,项目名称:trufont,代码行数:9,代码来源:colorWidgets.py

示例9: mouseDoubleClickEvent

 def mouseDoubleClickEvent(self, event):
     event.accept()
     if self._readOnly:
         return
     dialog = QColorDialog()
     ok = dialog.exec_()
     if ok:
         self.setColor(dialog.currentColor())
         self.colorChanged.emit()
开发者ID:paarandika,项目名称:trufont,代码行数:9,代码来源:colorWidgets.py

示例10: ColorDialog_getColor

    def ColorDialog_getColor(self, color=None, parent=None, name=None):
        from PyQt5.QtWidgets import QColorDialog
        from PyQt5.QtGui import QColor

        if color is None:
            color = QColor.black()

        if isinstance(color, str):
            color = QColor()

        cL = QColorDialog(color, parent)
        return cL.getColor()
开发者ID:deavid,项目名称:pineboo,代码行数:12,代码来源:AQS.py

示例11: showDialog

    def showDialog(self):

        col = QColorDialog.getColor()

        if col.isValid():
            self.frm.setStyleSheet("QWidget { background-color: %s }"
                % col.name())
开发者ID:Laponina,项目名称:learn_english,代码行数:7,代码来源:7.py

示例12: chooseBestColor

 def chooseBestColor(self):
     self.bestColor = QColorDialog.getColor(self.bestColor)
     self.setBestColorButton(self.bestColor)
     if self.tag != None:
         self.taggedTextWidget.showDataNoWait(self.tag)
         self.taggedDocumentWidget.showDateNoWaitDetails(self.tag)
     self.update_colorbar()
开发者ID:Zarnosch,项目名称:AVaAoMDTV,代码行数:7,代码来源:testqt.py

示例13: _bbTableDoubleClicked

    def _bbTableDoubleClicked(self, row, col):
        """
        This overrides the callback for table's double click
        set in the CustomWidget object.
        Apparently if there is an exception it falls back to
        the original callback... Not sure why this behaviour.
        NOTE: This is kind of nasty.
        :return: None
        """
        it = self.table.item(row, col).text()

        try:
            idx = int(it)   # decimal
            bb_path = self.ba.cache.bb_paths[idx]

            col = QColorDialog.getColor()
            if col.isValid():
                # IDA works with BGR (annoying)
                ida_color = misc.pyside_to_ida_color(col.name())
                misc.paint_basic_blocks(bb_path, ida_color)

            else:
                print '[x] Invalid QColor'

            return

        except IndexError:
            # Address value (does not contain [A-F]) is interpreted as index
            return

        except ValueError:
            # Address value (containing [A-F]) fucks up int()
            return
开发者ID:carlosgprado,项目名称:JARVIS,代码行数:33,代码来源:BinaryAnalysisWidget.py

示例14: on_bgcolor_click

	def on_bgcolor_click(self):
		initial = self.input_bgcolor.text()
		color = QColorDialog.getColor(QColor(initial), self, "Choose background color")
		if color.isValid():
			
			self.input_bgcolor.setText(color.name())
			self.update_colors(fg_override=self.input_fgcolor.text(), bg_override=color.name())
开发者ID:usssentinel,项目名称:livestreamer_gui,代码行数:7,代码来源:gui_dialogs.py

示例15: bgColorDialog

 def bgColorDialog(self):
     """Open color dialog to pick a color.
     """
     color = QColorDialog.getColor()
     if color.isValid():
         self.bgColor = color
         common.setPickerColor(color, self.bgColorPicker)
开发者ID:smajida,项目名称:detection,代码行数:7,代码来源:detection.py


注:本文中的PyQt5.QtWidgets.QColorDialog类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。