本文整理汇总了Python中PyQt5.QtCore.Qt.black方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.black方法的具体用法?Python Qt.black怎么用?Python Qt.black使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.Qt
的用法示例。
在下文中一共展示了Qt.black方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import black [as 别名]
def __init__(self):
QtWidgets.QWidget.__init__(self)
uic.loadUi("window.ui", self)
self.scene = QGraphicsScene(0, 0, 711, 601)
self.scene.win = self
self.view.setScene(self.scene)
self.image = QImage(710, 600, QImage.Format_Alpha8)
self.image.fill(black)
self.pen = QPen(black)
self.draw.clicked.connect(lambda: draw(self))
self.dial_x.valueChanged.connect(lambda: draw(self))
self.dial_y.valueChanged.connect(lambda: draw(self))
self.dial_z.valueChanged.connect(lambda: draw(self))
self.funcs.addItem("cos(x) * sin(z)")
self.funcs.addItem("2 * cos(x * z)")
self.funcs.addItem("exp(sin(sqrt(x^2 + z^2)))")
self.funcs.addItem("x^2 / 20 + z^2 / 20")
self.funcs.addItem("|sin(x) * sin(z)|")
示例2: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import black [as 别名]
def __init__(self):
QtWidgets.QWidget.__init__(self)
uic.loadUi("window.ui", self)
self.scene = Scene(0, 0, 561, 581)
self.scene.win = self
self.view.setScene(self.scene)
self.image = QImage(561, 581, QImage.Format_ARGB32_Premultiplied)
self.image.fill(Qt.white)
self.bars.clicked.connect(lambda : set_bars(self))
self.erase.clicked.connect(lambda: clean_all(self))
self.paint.clicked.connect(lambda: clipping(self))
self.rect.clicked.connect(lambda: set_rect(self))
self.ect.clicked.connect(lambda: add_bars(self))
self.lock.clicked.connect(lambda: lock(self))
self.lines = []
self.edges = []
self.clip = None
self.point_now_rect = None
self.point_now_bars = None
self.point_lock = None
self.input_bars = False
self.input_rect = False
self.pen = QPen(black)
示例3: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import black [as 别名]
def __init__(self):
QtWidgets.QWidget.__init__(self)
uic.loadUi("window.ui", self)
self.scene = QtWidgets.QGraphicsScene(0, 0, 511, 511)
self.mainview.setScene(self.scene)
self.image = QImage(511, 511, QImage.Format_ARGB32_Premultiplied)
self.pen = QPen()
self.color_line = QColor(Qt.black)
self.color_bground = QColor(Qt.white)
self.draw_once.clicked.connect(lambda: draw_once(self))
self.clean_all.clicked.connect(lambda: clear_all(self))
self.btn_bground.clicked.connect(lambda: get_color_bground(self))
self.btn_line.clicked.connect(lambda: get_color_line(self))
self.draw_centr.clicked.connect(lambda: draw_centr(self))
layout = QtWidgets.QHBoxLayout()
layout.addWidget(self.what)
layout.addWidget(self.other)
self.setLayout(layout)
self.circle.setChecked(True)
self.canon.setChecked(True)
#self.circle.toggled.connect(lambda : change_text(self))
示例4: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import black [as 别名]
def __init__(self):
QtWidgets.QWidget.__init__(self)
uic.loadUi("window.ui", self)
self.scene = Scene(0, 0, 561, 581)
self.scene.win = self
self.view.setScene(self.scene)
self.poly.clicked.connect(lambda : set_pol(self))
self.erase.clicked.connect(lambda: clean_all(self))
self.paint.clicked.connect(lambda: clipping(self))
self.rect.clicked.connect(lambda: set_rect(self))
self.ect.clicked.connect(lambda: add_bars(self))
self.lock.clicked.connect(lambda: lock(self))
self.clip = []
self.pol = []
self.point_now_clip = None
self.point_now_pol = None
self.point_lock_pol = None
self.point_lock_clip = None
self.input_pol = False
self.input_clip = False
self.pen = QPen(black)
示例5: _updateAutoForegroundColForeground
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import black [as 别名]
def _updateAutoForegroundColForeground(self, row):
item = self.item(row, self._autoForegroundCol)
if item is None: return
try:
value = float(item.data(self._role))
except Exception as ex:
value = 0 # if referenced item doesn't have value or not number, think it as default 0.
if value > 0:
color = Qt.red
elif value < 0:
color = Qt.darkGreen
else:
if item.background() == Qt.white: # for qdarkstyle
color = Qt.black
else:
color = QColor('#C0C0C0')
item.setForeground(color)
示例6: _getForeground
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import black [as 别名]
def _getForeground(self, rowData, autoForegroundCol, item):
# 如果@rowData的item个数小于等于@autoForegroundCol
# 支持row数据比header少的状况
try:
value = rowData[autoForegroundCol]
color = self.getForegroundOverride(value)
except Exception as ex:
color = None
if color is None:
if item.background() == Qt.white:
color = Qt.black
else: # for qdarkstyle
color = QColor(192, 192, 192)
return color
示例7: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import black [as 别名]
def __init__(self):
super(VideoStyleDark, self).__init__()
palette = qApp.palette()
palette.setColor(QPalette.Window, QColor(27, 35, 38))
palette.setColor(QPalette.WindowText, QColor(234, 234, 234))
palette.setColor(QPalette.Base, QColor(27, 35, 38))
palette.setColor(QPalette.AlternateBase, QColor(12, 15, 16))
palette.setColor(QPalette.ToolTipBase, QColor(27, 35, 38))
palette.setColor(QPalette.ToolTipText, Qt.white)
palette.setColor(QPalette.Text, QColor(234, 234, 234))
palette.setColor(QPalette.Button, QColor(27, 35, 38))
palette.setColor(QPalette.ButtonText, Qt.white)
palette.setColor(QPalette.BrightText, QColor(100, 215, 222))
palette.setColor(QPalette.Link, QColor(126, 71, 130))
# palette.setColor(QPalette.Highlight, QColor(126, 71, 130))
# palette.setColor(QPalette.HighlightedText, Qt.white)
palette.setColor(QPalette.Disabled, QPalette.Light, Qt.black)
palette.setColor(QPalette.Disabled, QPalette.Shadow, QColor(12, 15, 16))
qApp.setPalette(palette)
示例8: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import black [as 别名]
def __init__(self, types, parent=None, color=Qt.black):
"""
:param types: 渐变类型(0-透明,1-彩虹)
:param parent:
"""
super(CColorSlider, self).__init__(Qt.Horizontal, parent)
self.setObjectName('Custom_Color_Slider')
self.setCursor(Qt.PointingHandCursor)
self.valueChanged.connect(self.onValueChanged)
self._types = types
self._color = color
self._isFirstShow = True
self._imageRainbow = None # 彩虹背景图
self._imageAlphaColor = None # 带颜色透明图
self._imageAlphaTmp = None # 透明方格
self._imageAlpha = None # 带颜色透明背景和方格合成图
self._imageCircle = None # 圆形滑块图
self._imageCircleHover = None # 圆形滑块悬停图
self.setToolTip('彩虹色' if self._types == self.TypeRainbow else '透明度')
示例9: _h_assign_feat_color
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import black [as 别名]
def _h_assign_feat_color(self, irow):
feat_val = self.timeseries_data.loc[irow, self.feat_column]
if (feat_val != feat_val):
return Qt.black
#this function can and should be optimized
f_min = self.ui.feat_min_value.value()
f_max = self.ui.feat_max_value.value()
if f_min == f_max: #dummy range in case all the values are the same
f_min, f_max = -1, 1
elif f_min > f_max:
return Qt.black
nn = np.clip((feat_val - f_min)/(f_max - f_min), 0, 1)
ind = int(np.round(nn*(self.n_colors-1)))
col = self.palette[ind]
return col
示例10: paint
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import black [as 别名]
def paint(self, painter: QPainter, option: QStyleOptionViewItem, index: QModelIndex):
if self.colors:
try:
item = index.model().data(index)
index = self.items.index(item) if item in self.items else int(item)
color = self.colors[index]
x, y, h = option.rect.x(), option.rect.y(), option.rect.height()
rect = QRectF(x + 8, y + h / 2 - 8, 16, 16)
painter.fillRect(rect, QColor("black"))
rect = rect.adjusted(1, 1, -1, -1)
painter.fillRect(rect, QColor(color.red(), color.green(), color.blue(), 255))
except:
super().paint(painter, option, index)
else:
super().paint(painter, option, index)
示例11: refreshMergedModList
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import black [as 别名]
def refreshMergedModList(self):
self.mergedModList.clear()
for modName in sorted(self.__mergedModInfo):
modPluginsState = self.getMergedModPluginsState(modName)
color = {
Dc.ModPluginsState.UNKNOWN: Dc.red,
Dc.ModPluginsState.ACTIVE: None,
Dc.ModPluginsState.MIXED: Dc.yellow,
Dc.ModPluginsState.INACTIVE: Dc.green
}[modPluginsState]
stateDescription = {
Dc.ModPluginsState.UNKNOWN: self.__tr("Unknown"),
Dc.ModPluginsState.ACTIVE: self.__tr("All plugins active"),
Dc.ModPluginsState.MIXED: self.__tr("Some plugins active"),
Dc.ModPluginsState.INACTIVE: self.__tr("All plugins inactive")
}[modPluginsState]
item = QtWidgets.QTreeWidgetItem(self.mergedModList, [modName, stateDescription])
for x in range(2):
if color:
item.setBackground(x, color)
item.setForeground(x, Qt.black)
item.setData(x, Qt.UserRole, {"modName": modName, "modPluginsState": modPluginsState})
self.mergedModList.addTopLevelItem(item)
self.mergedModList.resizeColumnToContents(0)
示例12: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import black [as 别名]
def __init__(self):
QtWidgets.QWidget.__init__(self)
uic.loadUi("window.ui", self)
self.scene = QtWidgets.QGraphicsScene(0, 0, 511, 511)
self.mainview.setScene(self.scene)
self.image = QImage(511, 511, QImage.Format_ARGB32_Premultiplied)
self.pen = QPen()
self.color_line = QColor(Qt.black)
self.color_bground = QColor(Qt.white)
self.draw_line.clicked.connect(lambda: draw_line(self))
self.clean_all.clicked.connect(lambda : clear_all(self))
self.btn_bground.clicked.connect(lambda: get_color_bground(self))
self.btn_line.clicked.connect(lambda: get_color_line(self))
self.draw_sun.clicked.connect(lambda: draw_sun(self))
self.cda.setChecked(True)
示例13: get_color_line
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import black [as 别名]
def get_color_line(win):
color = QtWidgets.QColorDialog.getColor(initial=Qt.black, title='Цвет линии',
options=QtWidgets.QColorDialog.DontUseNativeDialog)
if color.isValid():
win.color_line = color
win.pen.setColor(color)
s = QtWidgets.QGraphicsScene(0, 0, 10, 10)
s.setBackgroundBrush(color)
win.line_color.setScene(s)
示例14: draw
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import black [as 别名]
def draw(win):
win.scene.clear()
win.image.fill(black)
tx = win.dial_x.value()
ty = win.dial_y.value()
tz = win.dial_z.value()
if win.funcs.currentText() == "cos(x) * sin(z)":
f = f1
if win.funcs.currentText() == "2 * cos(x * z)":
f = f2
if win.funcs.currentText() == "exp(sin(sqrt(x^2 + z^2)))":
f = f3
if win.funcs.currentText() == "x^2 / 20 + z^2 / 20":
f = f4
if win.funcs.currentText() == "|sin(x) * sin(z)|":
f = f5
win.image = float_horizon(win.scene.width(), win.scene.height(), win.x_min.value(), win.x_max.value(), win.dx.value(),
win.z_min.value(), win.z_max.value(), win.dz.value(), tx, ty, tz, f, win.image)
pix = QPixmap()
pix.convertFromImage(win.image)
win.scene.addPixmap(pix)
示例15: _setAutoRowForeground
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import black [as 别名]
def _setAutoRowForeground(self, item):
if self._autoForegroundCol is None:
return
# ignore 'Org.' column
if self.__index and item.column() == 0:
return
# get forground of reference item
row = item.row()
refItem = self.item(row, self._autoForegroundCol)
if not refItem:
return
# set forground same as reference item
item.setForeground(refItem.foreground())
# we still need to go through row if value of reference item changed
if item.column() == self._autoForegroundCol:
# get foreground for row
color = self.getForegroundOverride(item.data(self._role))
if color is None:
if item.background() == Qt.white: # for qdarkstyle
color = Qt.black
else:
color = Qt.white
# no foreground changed
if item.foreground() == color:
return
for i in range(self.columnCount()):
if self.__index and i == 0: continue
item = self.item(row, i)
if item:
item.setForeground(color)