Python PyQt5.QtCore.Qt.white() Examples
The following are 30
code examples of PyQt5.QtCore.Qt.white().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5.QtCore.Qt
, or try the search function
.
Example #1
Source File: DyTableWidget.py From DevilYuan with MIT License | 6 votes |
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)
Example #2
Source File: sparrow-wifi.py From sparrow-wifi with GNU General Public License v3.0 | 6 votes |
def createSpectrumLine(self): if not self.spectrum24Line: # add it # 2.4 GHz self.spectrum24Line = self.createNewSeries(Qt.white, self.chart24) self.spectrum24Line.setName('Spectrum') self.chart24.addSeries(self.spectrum24Line) self.spectrum24Line.attachAxis(self.chart24.axisX()) self.spectrum24Line.attachAxis(self.chart24.axisY()) if not self.spectrum5Line: # 5 GHz self.spectrum5Line = self.createNewSeries(Qt.white, self.chart5) self.spectrum5Line.setName('Spectrum') self.chart5.addSeries(self.spectrum5Line) self.spectrum5Line.attachAxis(self.chart5.axisX()) self.spectrum5Line.attachAxis(self.chart5.axisY()) # self.spectrum5Line.setUseOpenGL(True) # This causes the entire window to go blank
Example #3
Source File: ProbeWindow.py From PyQt with GNU General Public License v3.0 | 6 votes |
def paintEvent(self, event): super(Label, self).paintEvent(event) # 中正间画十字 painter = QPainter(self) painter.setPen(Qt.red) x = int(self.width() / 2) y = int(self.height() / 2) painter.drawLine(x, 0, x, self.height()) painter.drawLine(0, y, self.width(), y) if self.ismd: # 画坐标点 pos = QCursor.pos() ret = win32gui.GetPixel(win32gui.GetWindowDC( win32gui.GetDesktopWindow()), pos.x(), pos.y()) r, g, b = ret & 0xff, (ret >> 8) & 0xff, (ret >> 16) & 0xff print(r, g, b) painter.setPen(Qt.white) painter.drawText(self.rect(), Qt.AlignLeft | Qt.AlignBottom, '({}, {})\nRGB: ({}, {}, {})\n{}'.format( pos.x(), pos.y(), r, g, b, QColor(r, g, b).name()))
Example #4
Source File: sparrow-wifi.py From sparrow-wifi with GNU General Public License v3.0 | 6 votes |
def __init__(self, displayText, parent, textColor=Qt.white): # super().__init__(displayText, parent) super().__init__(parent=parent) self.textColor = textColor self.chartParent = parent # Pen draws the outline, brush does the character fill # The doc says the pen is slow so don't use it unless you have to # penBorder = QPen(self.textColor) # penBorder.setWidth(2) # self.setPen(penBorder) newBrush = QBrush(self.textColor) self.setBrush(newBrush) # Has setText() and text() methods
Example #5
Source File: sparrow-wifi.py From sparrow-wifi with GNU General Public License v3.0 | 6 votes |
def __init__(self, parentChart, color=Qt.white): super().__init__() self.textColor = color self.parentChart = parentChart self.hovered.connect(self.onHover) self.callout = Callout(self.name(), parentChart, self.textColor) self.callout.setZValue(100) self.clicked.connect(self.onClicked) self.labelTimer = QTimer() self.labelTimerTimeout = 3000 self.labelTimer.timeout.connect(self.onLabelTimer) self.labelTimer.setSingleShot(True) self.timerRunning = False
Example #6
Source File: videostyle.py From vidcutter with GNU General Public License v3.0 | 6 votes |
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)
Example #7
Source File: CColorStraw.py From CustomWidgets with GNU General Public License v3.0 | 6 votes |
def paintEvent(self, event): super(ScaleWindow, self).paintEvent(event) if self._image: painter = QPainter(self) painter.setRenderHint(QPainter.Antialiasing, True) path = QPainterPath() radius = min(self.width(), self.height()) / 2 path.addRoundedRect(QRectF(self.rect()), radius, radius) painter.setClipPath(path) # 图片 painter.drawImage(self.rect(), self._image) # 中间蓝色十字线 painter.setPen(QPen(QColor(0, 174, 255), 3)) hw = self.width() / 2 hh = self.height() / 2 painter.drawLines( QLineF(hw, 0, hw, self.height()), QLineF(0, hh, self.width(), hh) ) # 边框 painter.setPen(QPen(Qt.white, 3)) painter.drawRoundedRect(self.rect(), radius, radius)
Example #8
Source File: DyTableWidget.py From DevilYuan with MIT License | 6 votes |
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
Example #9
Source File: DyTableWidget.py From DevilYuan with MIT License | 6 votes |
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)
Example #10
Source File: DyTableWidget.py From DevilYuan with MIT License | 6 votes |
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
Example #11
Source File: botonCircular.py From PyQt5 with MIT License | 6 votes |
def paintEvent(self, event): ancho, altura = self.width(), self.height() icono = self.icono.scaled(ancho, altura, Qt.KeepAspectRatio, Qt.SmoothTransformation) pintor = QPainter() pintor.begin(self) pintor.setRenderHint(QPainter.Antialiasing, True) pintor.setPen(Qt.NoPen) pintor.drawPixmap(0, 0, icono, 0, 0, 0, 0) pintor.setPen(Qt.white) pintor.drawText(event.rect(), Qt.AlignCenter, self.etiqueta) pintor.setPen(Qt.NoPen) pintor.setBrush(self.opacidad) pintor.drawEllipse(0, 0, ancho, altura) pintor.end() self.setMask(icono.mask())
Example #12
Source File: idacyber.py From IDACyber with MIT License | 6 votes |
def paint_status(self): a_offs = 20 base_x = self.rect_x + self.get_pixel_qty_per_line() * self.pixelSize + a_offs + 10 lines = [] lines.append("[Data]") lines.append(" Type: %s" % self.formatters[self.cur_formatter_idx][1]) lines.append(" Mode: %s" % self.composition_modes[self.cur_compos_mode][1]) cur_line = 1 text_x_pos = base_x + 10 self.qp.setPen(QColor(Qt.white)) for line in lines: text_y_pos = self.rect().height() - (self.qp.fontMetrics().height()/2) - (len(lines) - cur_line) * (self.qp.fontMetrics().height()) # draw status self.qp.drawText(text_x_pos, text_y_pos, line) cur_line += 1 # functions that can be called by filters # must no be called from within on_process_buffer()
Example #13
Source File: lab4.py From Computer-graphics with MIT License | 6 votes |
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))
Example #14
Source File: lab8.py From Computer-graphics with MIT License | 6 votes |
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)
Example #15
Source File: lab7.py From Computer-graphics with MIT License | 6 votes |
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.lines = [] self.clip = None self.point_now = None self.input_bars = False self.input_rect = False self.pen = QPen(red)
Example #16
Source File: lab3.py From Computer-graphics with MIT License | 6 votes |
def get_color_bground(win): color = QtWidgets.QColorDialog.getColor(initial=Qt.white, title='Цвет фона', options=QtWidgets.QColorDialog.DontUseNativeDialog) if color.isValid(): win.color_bground = color win.image.fill(color) s = QtWidgets.QGraphicsScene(0, 0, 10, 10) s.setBackgroundBrush(color) win.bground_color.setScene(s) win.scene.setBackgroundBrush(color)
Example #17
Source File: lab3.py From Computer-graphics with MIT License | 6 votes |
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)
Example #18
Source File: TrackerViewerAux.py From tierpsy-tracker with MIT License | 5 votes |
def _drawSkel(self, worm_qimg, skel_dat, skel_colors = GOOD_SKEL_COLOURS): qPlg = {} for tt, dat in skel_dat.items(): qPlg[tt] = QPolygonF() for p in dat: #do not add point if it is nan if p[0] == p[0]: qPlg[tt].append(QPointF(*p)) if not qPlg or len(qPlg['skeleton']) == 0: return pen = QPen() pen.setWidth(1) painter = QPainter() painter.begin(worm_qimg) for k, pol_v in qPlg.items(): color = skel_colors[k] pen.setColor(QColor(*color)) painter.setPen(pen) painter.drawPolyline(pol_v) pen.setColor(Qt.black) painter.setBrush(Qt.white) painter.setPen(pen) radius = 3 painter.drawEllipse(qPlg['skeleton'][0], radius, radius) painter.drawEllipse(QPointF(0,0), radius, radius) painter.end()
Example #19
Source File: MWTrackerViewer.py From tierpsy-tracker with MIT License | 5 votes |
def __init__(self, ui): super().__init__(ui) self.food_coordinates = None self.wlabC = { WLAB['U']: Qt.white, WLAB['WORM']: Qt.green, WLAB['WORMS']: Qt.blue, WLAB['BAD']: Qt.darkRed, WLAB['GOOD_SKE']: Qt.darkCyan } self.ui.checkBox_showFood.stateChanged.connect(self.updateImage) self.ui.checkBox_showFood.setEnabled(False) self.ui.checkBox_showFood.setChecked(True)
Example #20
Source File: splash.py From QssStylesheetEditor with GNU General Public License v3.0 | 5 votes |
def showMessage(self, msg): """Show the progress message on the splash image""" super(SplashScreen, self).showMessage(msg, self.labelAlignment, Qt.white) QApplication.processEvents()
Example #21
Source File: HotPlaylist.py From PyQt with GNU General Public License v3.0 | 5 votes |
def paintEvent(self, event): super(CoverLabel, self).paintEvent(event) if hasattr(self, "cover_title") and self.cover_title != "": # 底部绘制文字 painter = QPainter(self) rect = self.rect() # 粗略字体高度 painter.save() fheight = self.fontMetrics().height() # 底部矩形框背景渐变颜色 bottomRectColor = QLinearGradient( rect.width() / 2, rect.height() - 24 - fheight, rect.width() / 2, rect.height()) bottomRectColor.setSpread(QGradient.PadSpread) bottomRectColor.setColorAt(0, QColor(255, 255, 255, 70)) bottomRectColor.setColorAt(1, QColor(0, 0, 0, 50)) # 画半透明渐变矩形框 painter.setPen(Qt.NoPen) painter.setBrush(QBrush(bottomRectColor)) painter.drawRect(rect.x(), rect.height() - 24 - fheight, rect.width(), 24 + fheight) painter.restore() # 距离底部一定高度画文字 font = self.font() or QFont() font.setPointSize(8) painter.setFont(font) painter.setPen(Qt.white) rect.setHeight(rect.height() - 12) # 底部减去一定高度 painter.drawText(rect, Qt.AlignHCenter | Qt.AlignBottom, self.cover_title)
Example #22
Source File: HotPlaylist.py From PyQt with GNU General Public License v3.0 | 5 votes |
def paintEvent(self, event): super(CoverLabel, self).paintEvent(event) if hasattr(self, "cover_title") and self.cover_title != "": # 底部绘制文字 painter = QPainter(self) rect = self.rect() # 粗略字体高度 painter.save() fheight = self.fontMetrics().height() # 底部矩形框背景渐变颜色 bottomRectColor = QLinearGradient( rect.width() / 2, rect.height() - 24 - fheight, rect.width() / 2, rect.height()) bottomRectColor.setSpread(QGradient.PadSpread) bottomRectColor.setColorAt(0, QColor(255, 255, 255, 70)) bottomRectColor.setColorAt(1, QColor(0, 0, 0, 50)) # 画半透明渐变矩形框 painter.setPen(Qt.NoPen) painter.setBrush(QBrush(bottomRectColor)) painter.drawRect(rect.x(), rect.height() - 24 - fheight, rect.width(), 24 + fheight) painter.restore() # 距离底部一定高度画文字 font = self.font() or QFont() font.setPointSize(8) painter.setFont(font) painter.setPen(Qt.white) rect.setHeight(rect.height() - 12) # 底部减去一定高度 painter.drawText(rect, Qt.AlignHCenter | Qt.AlignBottom, self.cover_title)
Example #23
Source File: ChartView.py From PyQt with GNU General Public License v3.0 | 5 votes |
def __getColor(self, color=None, default=Qt.white): ''' :param color: int|str|[r,g,b]|[r,g,b,a] ''' if not color: return QColor(default) if isinstance(color, QBrush): return color # 比如[r,g,b]或[r,g,b,a] if isinstance(color, list) and 3 <= len(color) <= 4: return QColor(*color) else: return QColor(color)
Example #24
Source File: qtmodels.py From QualCoder with MIT License | 5 votes |
def data(self,index,role): if index.isValid(): key = self._row_to_key[index.row()] if role == Qt.DisplayRole: if self.key is None: return key else: return self.nativedata[key][self.key] elif role == Qt.ForegroundRole: return QtGui.QBrush(Qt.black) elif role == Qt.BackgroundRole: return QtGui.QBrush(QtGui.QColor(self.nativedata[key].get('color',Qt.white))) elif role == Qt.CheckStateRole: return self._checkstate.get(key,Qt.CheckState.Unchecked)
Example #25
Source File: ChartView.py From PyQt with GNU General Public License v3.0 | 5 votes |
def __getPen(self, pen=None, default=QPen( Qt.white, 1, Qt.SolidLine, Qt.SquareCap, Qt.BevelJoin)): ''' :param pen: pen json ''' if not pen or not isinstance(pen, dict): return default return QPen( self.__getColor(pen.get("color", None) or default.color()), pen.get("width", 1) or 1, pen.get("style", 0) or 0, pen.get("capStyle", 16) or 16, pen.get("joinStyle", 64) or 64 )
Example #26
Source File: VerificationCode.py From PyQt with GNU General Public License v3.0 | 5 votes |
def paintEvent(self, event): painter = QPainter(self) painter.setRenderHint(QPainter.Antialiasing) # 背景白色 painter.fillRect(event.rect(), QBrush(Qt.white)) # 绘制边缘虚线框 painter.setPen(Qt.DashLine) painter.setBrush(Qt.NoBrush) painter.drawRect(self.rect()) # 随机画条线 for _ in range(3): painter.setPen(QPen(QTCOLORLIST[qrand() % 5], 1, Qt.SolidLine)) painter.setBrush(Qt.NoBrush) painter.drawLine(QPoint(0, qrand() % self.height()), QPoint(self.width(), qrand() % self.height())) painter.drawLine(QPoint(qrand() % self.width(), 0), QPoint(qrand() % self.width(), self.height())) # 绘制噪点 painter.setPen(Qt.DotLine) painter.setBrush(Qt.NoBrush) for _ in range(self.width()): # 绘制噪点 painter.drawPoint(QPointF(qrand() % self.width(), qrand() % self.height())) # super(WidgetCode, self).paintEvent(event) # 绘制文字 # 绘制跳动文字 metrics = QFontMetrics(self.font()) x = (self.width() - metrics.width(self.text())) / 2 y = (self.height() + metrics.ascent() - metrics.descent()) / 2 for i, ch in enumerate(self.text()): index = (self.step + i) % 16 painter.setPen(TCOLORLIST[qrand() % 6]) painter.drawText(x, y - ((SINETABLE[index] * metrics.height()) / 400), ch) x += metrics.width(ch)
Example #27
Source File: GifSplashScreen.py From PyQt with GNU General Public License v3.0 | 5 votes |
def createWindow(): app.w = QWidget() # 模拟初始5秒后再显示 splash.showMessage('等待界面显示', Qt.AlignHCenter | Qt.AlignBottom, Qt.white) QTimer.singleShot(3000, lambda: ( splash.showMessage('初始化完成', Qt.AlignHCenter | Qt.AlignBottom, Qt.white), app.w.show(), splash.finish(app.w))) # 模拟耗时5秒。但是不能用sleep # 可以使用子线程加载耗时的数据 # 主线程中循环设置UI可以配合QApplication.instance().processEvents()
Example #28
Source File: HotPlaylist.py From PyQt with GNU General Public License v3.0 | 5 votes |
def paintEvent(self, event): super(CoverLabel, self).paintEvent(event) if hasattr(self, "cover_title") and self.cover_title != "": # 底部绘制文字 painter = QPainter(self) rect = self.rect() # 粗略字体高度 painter.save() fheight = self.fontMetrics().height() # 底部矩形框背景渐变颜色 bottomRectColor = QLinearGradient( rect.width() / 2, rect.height() - 24 - fheight, rect.width() / 2, rect.height()) bottomRectColor.setSpread(QGradient.PadSpread) bottomRectColor.setColorAt(0, QColor(255, 255, 255, 70)) bottomRectColor.setColorAt(1, QColor(0, 0, 0, 50)) # 画半透明渐变矩形框 painter.setPen(Qt.NoPen) painter.setBrush(QBrush(bottomRectColor)) painter.drawRect(rect.x(), rect.height() - 24 - fheight, rect.width(), 24 + fheight) painter.restore() # 距离底部一定高度画文字 font = self.font() or QFont() font.setPointSize(8) painter.setFont(font) painter.setPen(Qt.white) rect.setHeight(rect.height() - 12) # 底部减去一定高度 painter.drawText(rect, Qt.AlignHCenter | Qt.AlignBottom, self.cover_title)
Example #29
Source File: qrcode.py From artisan with GNU General Public License v3.0 | 5 votes |
def __init__(self, border, width, box_size): self.border = border self.width = width self.box_size = box_size size = (width + border * 2) * box_size self._image = QImage( size, size, QImage.Format_RGB16) self._image.fill(Qt.white)
Example #30
Source File: DyTableWidget.py From DevilYuan with MIT License | 5 votes |
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)