本文整理汇总了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),
)
示例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()
示例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()
示例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())
示例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)
示例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())
示例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())
示例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
示例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)
示例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()
示例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
示例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()
示例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()))
示例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()
示例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)