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


Python QColorDialog.getColor方法代码示例

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


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

示例1: on_bTest_clicked

# 需要导入模块: from PyQt5.QtWidgets import QColorDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QColorDialog import getColor [as 别名]
    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,代码行数:34,代码来源:ColorDialogWizardDialog.py

示例2: changeColor

# 需要导入模块: from PyQt5.QtWidgets import QColorDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QColorDialog import getColor [as 别名]
    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,代码行数:31,代码来源:widget_images.py

示例3: action

# 需要导入模块: from PyQt5.QtWidgets import QColorDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QColorDialog import getColor [as 别名]
    def action(self):
        qt_color_old = QColor(self.value)
        qt_color = QColorDialog.getColor(qt_color_old)

        if qt_color.isValid():
            self.value = qt_color.name()
            self.app.refresh()
开发者ID:krassowski,项目名称:Anki-Night-Mode,代码行数:9,代码来源:actions_and_settings.py

示例4: on_bgcolor_click

# 需要导入模块: from PyQt5.QtWidgets import QColorDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QColorDialog import getColor [as 别名]
	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,代码行数:9,代码来源:gui_dialogs.py

示例5: bgColorDialog

# 需要导入模块: from PyQt5.QtWidgets import QColorDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QColorDialog import getColor [as 别名]
 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,代码行数:9,代码来源:detection.py

示例6: showDialog

# 需要导入模块: from PyQt5.QtWidgets import QColorDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QColorDialog import getColor [as 别名]
    def showDialog(self):

        col = QColorDialog.getColor()

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

示例7: savePointDistanceStyle

# 需要导入模块: from PyQt5.QtWidgets import QColorDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QColorDialog import getColor [as 别名]
 def savePointDistanceStyle(self):
     if self.sender().objectName() == 'btnFontColor':
         self.sender().fontColor = QColorDialog.getColor()
     self.setPointDistanceStyle()
     self.saveSettings('markerLabelFont', self.cmbFonts.currentText())
     self.saveSettings('markerLabelColor', self.btnFontColor.fontColor.name())
     self.saveSettings('markerLabelSize', self.cmbFontSizes.currentText())
开发者ID:gis-support,项目名称:gps-tracker,代码行数:9,代码来源:GPSTrackerDialog.py

示例8: actionSetMoveLineColorSlot

# 需要导入模块: from PyQt5.QtWidgets import QColorDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QColorDialog import getColor [as 别名]
 def actionSetMoveLineColorSlot(self) -> None:
     # Inspector doesn't understand Qt's static methods
     # noinspection PyCallByClass,PyTypeChecker
     color = QColorDialog.getColor(self.moveLineColor, self,
                                   'Select new move line color')
     if QColor.isValid(color):
         self.moveLineColor = color
开发者ID:Longhanks,项目名称:QGVisualizer,代码行数:9,代码来源:mainwindow.py

示例9: doubleClicked

# 需要导入模块: from PyQt5.QtWidgets import QColorDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QColorDialog import getColor [as 别名]
    def doubleClicked(self, model_index):
        """Double click handler for the property table"""
        # Get data model and selection
        model = self.clip_properties_model.model

        row = model_index.row()
        selected_label = model.item(row, 0)
        self.selected_item = model.item(row, 1)

        if selected_label:
            property = selected_label.data()
            property_type = property[1]["type"]

            if property_type == "color":
                # Get current value of color
                red = property[1]["red"]["value"]
                green = property[1]["green"]["value"]
                blue = property[1]["blue"]["value"]

                # Show color dialog
                currentColor = QColor(red, green, blue)
                newColor = QColorDialog.getColor(currentColor)

                # Set the new color keyframe
                self.clip_properties_model.color_update(self.selected_item, newColor)
开发者ID:Algomorph,项目名称:openshot-qt,代码行数:27,代码来源:properties_tableview.py

示例10: chooseBestColor

# 需要导入模块: from PyQt5.QtWidgets import QColorDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QColorDialog import getColor [as 别名]
 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,代码行数:9,代码来源:testqt.py

示例11: _bbTableDoubleClicked

# 需要导入模块: from PyQt5.QtWidgets import QColorDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QColorDialog import getColor [as 别名]
    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,代码行数:35,代码来源:BinaryAnalysisWidget.py

示例12: changeFColor

# 需要导入模块: from PyQt5.QtWidgets import QColorDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QColorDialog import getColor [as 别名]
    def changeFColor(self):
        initial = QColor(*map(int, re.findall('\d{1,3}', self.fColor)))
        color = QColorDialog.getColor(initial, parent=self)

        if(color.isValid()):
            self.fColor = 'rgb' + str(color.getRgb())
            self.updatePreview()
开发者ID:tornel,项目名称:linux-show-player,代码行数:9,代码来源:cue_appearance.py

示例13: set_color_picker_value

# 需要导入模块: from PyQt5.QtWidgets import QColorDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QColorDialog import getColor [as 别名]
 def set_color_picker_value(self):
     color = self.color_temp
     r, g, b = Color.from_factor_to_rgb(color[0], color[1], color[2])
     q_color = QColor(r, g, b)
     new_color = QColorDialog.getColor(q_color)
     button = self.ui.pushButton_colorPicker
     self.color_temp = Color.from_rgb_to_factor(new_color.red(), new_color.green(), new_color.blue())
     button.setStyleSheet("background-color: rgb({},{},{})".format(new_color.red(), new_color.green(), new_color.blue()))
开发者ID:johanesmikhael,项目名称:ContinuityAnalysis,代码行数:10,代码来源:material_browser_gui.py

示例14: colorSelected

# 需要导入模块: from PyQt5.QtWidgets import QColorDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QColorDialog import getColor [as 别名]
 def colorSelected(self):
     color = QColorDialog.getColor(Qt.white, self)
     if not color.name() == "#000000":
         settings().setValue("Subtitle/color", color)
         settings().sync()
         self.color_button.setStyleSheet("QPushButton {border: 1px solid black; border-radius: 3px; \
                                     background-color: %s; }"%color.name())
         self.parent.settingsChanged.emit()
开发者ID:mthnzbk,项目名称:pisi-player,代码行数:10,代码来源:settingsdialog.py

示例15: colorDialog

# 需要导入模块: from PyQt5.QtWidgets import QColorDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QColorDialog import getColor [as 别名]
    def colorDialog(self):
        """Open color dialog to pick a color.
        """
        color = QColorDialog.getColor()

        if color.isValid():
            self.backgroundColor = color
            self.setPickerColor(color, self.colorPicker)
开发者ID:xsyann,项目名称:clustering,代码行数:10,代码来源:clustering.py


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