本文整理汇总了Python中PyQt5.QtCore.Qt.gray方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.gray方法的具体用法?Python Qt.gray怎么用?Python Qt.gray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.Qt
的用法示例。
在下文中一共展示了Qt.gray方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import gray [as 别名]
def __init__(self, parent=None):
super(MessageArea, self).__init__(parent)
self.setReadOnly(True)
self.sender_format = _StandardTextFormat(Qt.gray, self.fontWeight())
self.time_format = _StandardTextFormat(Qt.gray, self.fontWeight())
self.text_format = _StandardTextFormat()
# styling
self.setWindowFlags(Qt.FramelessWindowHint)
self.setAttribute(Qt.WA_TranslucentBackground)
self.viewport().setAutoFillBackground(False)
self.name_formats = {}
self.listeners = []
sound_filepath = path.join(path.dirname(__file__),
'resources',
'click.wav')
# sound_filepath = path.abspath(sound_filepath)
sound_filepath = QtCore.QUrl.fromLocalFile(sound_filepath)
self.sound = QtMultimedia.QSoundEffect()
self.sound.setSource(sound_filepath)
self.sound.setVolume(0.5)
self.sound.setLoopCount(1)
示例2: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import gray [as 别名]
def __init__(self, *args, **kwargs):
super(ChartView, self).__init__(*args, **kwargs)
self.resize(800, 600)
self.setRenderHint(QPainter.Antialiasing) # 抗锯齿
self.initChart()
# 提示widget
self.toolTipWidget = GraphicsProxyWidget(self._chart)
# line 宽度需要调整
self.lineItem = QGraphicsLineItem(self._chart)
pen = QPen(Qt.gray)
self.lineItem.setPen(pen)
self.lineItem.setZValue(998)
self.lineItem.hide()
# 一些固定计算,减少mouseMoveEvent中的计算量
# 获取x和y轴的最小最大值
axisX, axisY = self._chart.axisX(), self._chart.axisY()
self.category_len = len(axisX.categories())
self.min_x, self.max_x = -0.5, self.category_len - 0.5
self.min_y, self.max_y = axisY.min(), axisY.max()
# 坐标系中左上角顶点
self.point_top = self._chart.mapToPosition(
QPointF(self.min_x, self.max_y))
示例3: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import gray [as 别名]
def __init__(self, *args, **kwargs):
super(ChartView, self).__init__(*args, **kwargs)
self.resize(800, 600)
self.setRenderHint(QPainter.Antialiasing) # 抗锯齿
# 自定义x轴label
self.category = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"]
self.initChart()
# 提示widget
self.toolTipWidget = GraphicsProxyWidget(self._chart)
# line
self.lineItem = QGraphicsLineItem(self._chart)
pen = QPen(Qt.gray)
pen.setWidth(1)
self.lineItem.setPen(pen)
self.lineItem.setZValue(998)
self.lineItem.hide()
# 一些固定计算,减少mouseMoveEvent中的计算量
# 获取x和y轴的最小最大值
axisX, axisY = self._chart.axisX(), self._chart.axisY()
self.min_x, self.max_x = axisX.min(), axisX.max()
self.min_y, self.max_y = axisY.min(), axisY.max()
示例4: setBlackoutColors
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import gray [as 别名]
def setBlackoutColors(self):
global colors
global orange
colors = [Qt.red, Qt.yellow, Qt.darkYellow, Qt.green, Qt.darkGreen, orange, Qt.blue,Qt.cyan, Qt.darkCyan, Qt.magenta, Qt.darkMagenta, Qt.gray]
# return
# self.setStyleSheet("background-color: black")
#self.Plot24.setBackgroundBrush(Qt.black)
mainTitleBrush = QBrush(Qt.red)
self.chart24.setTitleBrush(mainTitleBrush)
self.chart5.setTitleBrush(mainTitleBrush)
self.chart24.setBackgroundBrush(QBrush(Qt.black))
self.chart24.axisX().setLabelsColor(Qt.white)
self.chart24.axisY().setLabelsColor(Qt.white)
titleBrush = QBrush(Qt.white)
self.chart24.axisX().setTitleBrush(titleBrush)
self.chart24.axisY().setTitleBrush(titleBrush)
#self.Plot5.setBackgroundBrush(Qt.black)
self.chart5.setBackgroundBrush(QBrush(Qt.black))
self.chart5.axisX().setLabelsColor(Qt.white)
self.chart5.axisY().setLabelsColor(Qt.white)
self.chart5.axisX().setTitleBrush(titleBrush)
self.chart5.axisY().setTitleBrush(titleBrush)
#$ self.networkTable.setStyleSheet("QTableCornerButton::section{background-color: white;}")
# self.networkTable.cornerWidget().setStylesheet("background-color: black")
self.networkTable.setStyleSheet("QTableView {background-color: black;gridline-color: white;color: white} QTableCornerButton::section{background-color: white;}")
headerStyle = "QHeaderView::section{background-color: white;border: 1px solid black;color: black;} QHeaderView::down-arrow,QHeaderView::up-arrow {background: none;}"
self.networkTable.horizontalHeader().setStyleSheet(headerStyle)
self.networkTable.verticalHeader().setStyleSheet(headerStyle)
示例5: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import gray [as 别名]
def __init__(self, *args, **kwargs):
super(CColorPicker, self).__init__(*args, **kwargs)
self.setObjectName('Custom_Color_Dialog')
self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint)
self.setAttribute(Qt.WA_TranslucentBackground, True)
self.setStyleSheet(Stylesheet)
self.mPos = None
self.initUi()
self.initSignals()
# 添加阴影
effect = QGraphicsDropShadowEffect(self)
effect.setBlurRadius(10)
effect.setOffset(0, 0)
effect.setColor(Qt.gray)
self.setGraphicsEffect(effect)
示例6: _set_java_context
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import gray [as 别名]
def _set_java_context(self, ptr, context):
if self.indexOf(self._javactx_list) == -1:
self.addTab(self._javactx_list, 'Java')
self.show_context_tab('Java')
else:
self.show_context_tab('Java')
for arg in context:
_arg = QStandardItem()
_arg.setText(arg)
_class = QStandardItem()
_class.setText(context[arg]['className'])
if isinstance(context[arg]['handle'], str):
_class.setForeground(Qt.lightGray)
_value = QStandardItem()
if 'arg' not in context[arg] or context[arg]['arg'] is None:
_value.setText('null')
_value.setForeground(Qt.gray)
else:
_value.setText(context[arg]['arg'])
self._javactx_model.appendRow([_arg, _class, _value])
self._javactx_list.resizeColumnToContents(0)
self._javactx_list.resizeColumnToContents(1)
示例7: init
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import gray [as 别名]
def init(self):
self.setUtf8(True)
lexer = QsciLexerJSON(self)
self.setLexer(lexer)
self.setAutoCompletionCaseSensitivity(False) # 忽略大小写
self.setAutoCompletionSource(self.AcsAll)
self.setAutoCompletionThreshold(1) # 一个字符就弹出补全
self.setAutoIndent(True) # 自动缩进
self.setBackspaceUnindents(True)
self.setBraceMatching(self.StrictBraceMatch)
self.setIndentationGuides(True)
self.setIndentationsUseTabs(False)
self.setIndentationWidth(4)
self.setTabIndents(True)
self.setTabWidth(4)
self.setWhitespaceSize(1)
self.setWhitespaceVisibility(self.WsVisible)
self.setWhitespaceForegroundColor(Qt.gray)
self.setWrapIndentMode(self.WrapIndentFixed)
self.setWrapMode(self.WrapWord)
# 折叠
self.setFolding(self.BoxedTreeFoldStyle, 2)
self.setFoldMarginColors(QColor("#676A6C"), QColor("#676A6D"))
font = self.font() or QFont()
font.setFamily("Consolas")
font.setFixedPitch(True)
font.setPointSize(13)
self.setFont(font)
self.setMarginsFont(font)
self.fontmetrics = QFontMetrics(font)
lexer.setFont(font)
self.setMarginWidth(0, self.fontmetrics.width(str(self.lines())) + 6)
self.setMarginLineNumbers(0, True)
self.setMarginsBackgroundColor(QColor("gainsboro"))
self.setMarginWidth(1, 0)
self.setMarginWidth(2, 14) # 折叠区域
# 绑定自动补齐热键Alt+/
completeKey = QShortcut(QKeySequence(Qt.ALT + Qt.Key_Slash), self)
completeKey.setContext(Qt.WidgetShortcut)
completeKey.activated.connect(self.autoCompleteFromAll)
示例8: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import gray [as 别名]
def __init__(self, *args, **kwargs):
super(Dialog, self).__init__(*args, **kwargs)
self.setObjectName('Custom_Dialog')
self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint)
self.setAttribute(Qt.WA_TranslucentBackground, True)
self.setStyleSheet(Stylesheet)
self.initUi()
# 添加阴影
effect = QGraphicsDropShadowEffect(self)
effect.setBlurRadius(12)
effect.setOffset(0, 0)
effect.setColor(Qt.gray)
self.setGraphicsEffect(effect)
示例9: crearGraficoBarras
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import gray [as 别名]
def crearGraficoBarras(self):
paises = ["EEUU", "China", "Japon", "Alemania", "Reino Unido", "Resto del mundo"]
valores = [24.32, 14.85, 8.91, 12.54, 7.85, 31.53]
colores = [Qt.blue, Qt.red, Qt.darkYellow, Qt.gray, Qt.black, Qt.darkCyan]
grafico = QChart()
grafico.setMargins(QMargins(30, 30, 30, 30))
grafico.setTheme(QChart.ChartThemeLight)
grafico.setTitle("% Distribución del PIB global")
grafico.setAnimationOptions(QChart.SeriesAnimations)
for i in range(len(paises)):
series = QBarSeries()
barSet = QBarSet(paises[i])
barSet.setColor(colores[i])
barSet.setLabelColor(Qt.yellow)
barSet.append(valores[i])
series.append(barSet)
series.setLabelsVisible(True)
series.setLabelsAngle(-90)
# series.setLabelsPrecision(2)
series.setLabelsFormat("@value %")
series.setLabelsPosition(QAbstractBarSeries.LabelsCenter)
grafico.addSeries(series)
axisX = QBarCategoryAxis()
axisX.append(paises)
axisY = QValueAxis()
axisY.setRange(0, 31.53)
axisY.setTickCount(10)
axisY.setLabelFormat("%.2f %")
grafico.createDefaultAxes()
grafico.setAxisX(axisX, None)
grafico.setAxisY(axisY, None)
grafico.legend().setVisible(True)
grafico.legend().setAlignment(Qt.AlignBottom)
return grafico