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


Python QtWidgets.QColorDialog方法代码示例

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


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

示例1: _init_colorpicker

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QColorDialog [as 别名]
def _init_colorpicker(self):
        colorpicker = QtWidgets.QColorDialog()
        colorpicker.finished.connect(self.colorpicker_finished)
        return colorpicker 
开发者ID:pkkid,项目名称:pkmeter,代码行数:6,代码来源:gcal.py

示例2: get_color

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QColorDialog [as 别名]
def get_color(self, current_color):
        color_dialog = QtWidgets.QColorDialog()
        new_color = color_dialog.getColor(current_color)
        if new_color.isValid():  # Returned in case cancel is pressed
            return new_color
        else:
            return current_color 
开发者ID:BasioMeusPuga,项目名称:Lector,代码行数:9,代码来源:annotations.py

示例3: changeLabelColor

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QColorDialog [as 别名]
def changeLabelColor(self):
        if self.currentwidget is None:
            return

        if isinstance(self.currentwidget, displaymod.labelWidget):
            colordialog = widgets.QColorDialog()
            color = colordialog.getColor()
            if color.isValid():
                self.currentwidget.jsondata['color'] = "rgb(%i,%i,%i)" % (color.red(), color.green(), color.blue())

        self.reinitScreen() 
开发者ID:cedricp,项目名称:ddt4all,代码行数:13,代码来源:parameters.py

示例4: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QColorDialog [as 别名]
def __init__(self, *args, **kwargs):
        QtWidgets.QDialog.__init__(self, *args, **kwargs)

        self.completer = QtWidgets.QCompleter()
        self.completer_model = QtWidgets.QFileSystemModel(self.completer)
        self.completer.setModel(self.completer_model)
        self.completer.setMaxVisibleItems(8)

        loadUi(get_resource('dialog_config.ui'), self)

        self.ok_button.released.connect(
            self.setAttributes)
        self.ok_button.released.connect(
            self.close)

        self.apply_button.released.connect(
            self.setAttributes)

        self.vector_color_picker = QtWidgets.QColorDialog(self)
        self.vector_color_picker. \
            setCurrentColor(QtGui.QColor(*getConfig().vector_color))
        self.vector_color_picker. \
            setOption(self.vector_color_picker.ShowAlphaChannel)
        self.vector_color_picker.colorSelected.connect(
            self.updateVectorColor)
        self.vector_color_picker.setModal(True)
        self.vector_color.clicked.connect(
            self.vector_color_picker.show)

        self.vector_color.setValue = self.setButtonColor
        self.vector_color.value = self.getButtonColor

        self.chooseStoreDirButton.released.connect(
            self.chooseStoreDir)
        self.completer_model.setRootPath('')
        self.completer.setParent(self.default_gf_dir)
        self.default_gf_dir.setCompleter(self.completer)

        self.getAttributes() 
开发者ID:pyrocko,项目名称:kite,代码行数:41,代码来源:config.py

示例5: onColorPicker

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

        if self._color is not None:
            dlg.setCurrentColor(QColor(self._color))
        if dlg.exec_() == dlg.Accepted:
            self.setColor(dlg.currentColor().name()) 
开发者ID:FrancescoCeruti,项目名称:linux-show-player,代码行数:9,代码来源:qcolorbutton.py

示例6: ask_color

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QColorDialog [as 别名]
def ask_color(initial=None):
    if initial is not None:
        color = QtGui.QColor(initial & 0xFF, (initial >> 8) & 0xFF, (initial >> 16) & 0xFF)
        qcolor_dialog = QtWidgets.QColorDialog(color)

    else:
        qcolor_dialog = QtWidgets.QColorDialog()

    qcolor = qcolor_dialog.getColor()

    if not qcolor.isValid:
        return None

    return (qcolor.blue() << 16) | (qcolor.green() << 8) | (qcolor.red() << 0) 
开发者ID:tmr232,项目名称:Sark,代码行数:16,代码来源:ui.py

示例7: ColorButtonClicked

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QColorDialog [as 别名]
def ColorButtonClicked(self):
        """Show the QColorDialog to let user choose new color"""
        dlg = QtWidgets.QColorDialog(self.color, self)
        if self.isAlpha:
            dlg.setOption(QtWidgets.QColorDialog.ShowAlphaChannel)
        if dlg.exec_():
            self.setColor(dlg.currentColor())
            self.valueChanged.emit(dlg.currentColor().name()) 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:10,代码来源:widgets.py

示例8: colorButtonClicked

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QColorDialog [as 别名]
def colorButtonClicked(self):
        """Show QColorDialog to change the color"""
        dlg = QtWidgets.QColorDialog(self.color, self)
        if dlg.exec_():
            self.setColor(dlg.currentColor()) 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:7,代码来源:widgets.py

示例9: colordialog

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QColorDialog [as 别名]
def colordialog(self):
        """Show dialog to choose font color"""
        dialog = QtWidgets.QColorDialog(self.notas.textColor(), self)
        if dialog.exec_():
            self.FontColor.setPalette(QtGui.QPalette(dialog.currentColor()))
            self.notas.setTextColor(dialog.currentColor())
            format = QtGui.QTextCharFormat()
            format.setForeground(dialog.currentColor())
            self.MergeFormat(format) 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:11,代码来源:texteditor.py

示例10: __init__

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

        self.tcl = ThreeColorLed(8, 10, 12)
        ccd = qtw.QColorDialog()
        ccd.setOptions(
            qtw.QColorDialog.NoButtons
            | qtw.QColorDialog.DontUseNativeDialog)
        ccd.currentColorChanged.connect(self.set_color)
        self.setCentralWidget(ccd)

        self.show() 
开发者ID:PacktPublishing,项目名称:Mastering-GUI-Programming-with-Python,代码行数:14,代码来源:three_color_led_gui.py

示例11: get_color

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QColorDialog [as 别名]
def get_color(self, signal_sender):
        def open_color_dialog(current_color):
            color_dialog = QtWidgets.QColorDialog()
            new_color = color_dialog.getColor(current_color)
            if new_color.isValid():  # Returned in case cancel is pressed
                return new_color
            else:
                return current_color

        # Special cases that don't affect (comic)book display
        if signal_sender == 'libraryBackground':
            current_color = self.settings['listview_background']
            new_color = open_color_dialog(current_color)
            self.listView.setStyleSheet("QListView {{background-color: {0}}}".format(
                new_color.name()))
            self.settings['listview_background'] = new_color
            return

        if signal_sender == 'dialogBackground':
            current_color = self.settings['dialog_background']
            new_color = open_color_dialog(current_color)
            self.settings['dialog_background'] = new_color
            return

        profile_index = self.bookToolBar.profileBox.currentIndex()
        current_profile = self.bookToolBar.profileBox.itemData(
            profile_index, QtCore.Qt.UserRole)

        # Retain current values on opening a new dialog
        if signal_sender == 'fgColor':
            current_color = current_profile['foreground']
            new_color = open_color_dialog(current_color)
            self.bookToolBar.colorBoxFG.setStyleSheet(
                'background-color: %s' % new_color.name())
            current_profile['foreground'] = new_color

        elif signal_sender == 'bgColor':
            current_color = current_profile['background']
            new_color = open_color_dialog(current_color)
            self.bookToolBar.colorBoxBG.setStyleSheet(
                'background-color: %s' % new_color.name())
            current_profile['background'] = new_color

        elif signal_sender == 'comicBGColor':
            current_color = self.comic_profile['background']
            new_color = open_color_dialog(current_color)
            self.bookToolBar.comicBGColor.setStyleSheet(
                'background-color: %s' % new_color.name())
            self.comic_profile['background'] = new_color

        self.bookToolBar.profileBox.setItemData(
            profile_index, current_profile, QtCore.Qt.UserRole)
        self.format_contentView() 
开发者ID:BasioMeusPuga,项目名称:Lector,代码行数:55,代码来源:guifunctions.py


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