本文整理汇总了Python中PyQt5.QtCore.Qt.blue方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.blue方法的具体用法?Python Qt.blue怎么用?Python Qt.blue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.Qt
的用法示例。
在下文中一共展示了Qt.blue方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: clipping
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import blue [as 别名]
def clipping(win):
buf = win.scene.itemAt(now, QTransform()).rect()
win.clip = [buf.left(), buf.right(), buf.top(), buf.bottom()]
for b in win.lines:
pass
win.pen.setColor(blue)
cohen_sutherland(b, win.clip, win)
win.pen.setColor(red)
示例2: clipping
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import blue [as 别名]
def clipping(win):
norm = isConvex(win.edges)
if not norm:
QMessageBox.warning(win, "Ошибка!", "Отсекатель не выпуклый!Операция не может быть проведена!")
for b in win.lines:
win.pen.setColor(blue)
cyrus_beck(b, win.edges, norm, win.scene, win.pen)
win.pen.setColor(red)
示例3: draw
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import blue [as 别名]
def draw(self, defending, status, scene, size):
"""function draw
:param defending: bool
:param status: str {'Charge', 'Shoot', 'Stand'}
:param scene: QGraphicsScene
:param size: QSize
no return
"""
if not isinstance(defending, bool):
raise ValueError('defending must be a boolean')
if not isinstance(status, str) or (status != 'Charge' and status != 'Shoot' and status != 'Stand'):
raise ValueError('status must be a str in {\'Charge\', \'Shoot\', \'Stand\'}')
self.unitType.draw(defending, status, scene, size)
flag_width = self.nation.flag.width() * 10 / self.nation.flag.height()
item = scene.addPixmap(self.nation.flag.scaled(flag_width, 10))
item.setPos(size.width() - 5 - flag_width, 0)
# life bar
item1 = QGraphicsRectItem(0, size.height() - 10, size.width() - 5, 5)
item1.setBrush(QBrush(Qt.white))
item2 = QGraphicsRectItem(0, size.height() - 10, self.unitStrength / 100 * (size.width() - 5), 5)
item2.setBrush(QBrush(Qt.green))
# moral bar
item3 = QGraphicsRectItem(0, size.height() - 15, size.width() - 5, 5)
item3.setBrush(QBrush(Qt.white))
item4 = QGraphicsRectItem(0, size.height() - 15, self.moral / 100 * (size.width() - 5), 5)
item4.setBrush(QBrush(Qt.blue))
scene.addItem(item1)
scene.addItem(item2)
scene.addItem(item3)
scene.addItem(item4)
示例4: setBlackoutColors
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import blue [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 blue [as 别名]
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)
示例6: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import blue [as 别名]
def __init__(self, *args, **kwargs):
super(Window, self).__init__(*args, **kwargs)
layout = QHBoxLayout(self)
# 绿色边框
labelGreen = QLabel(self, pixmap=QPixmap('Data/1.jpg').scaled(100, 100))
layout.addWidget(labelGreen)
aniGreen = AnimationShadowEffect(Qt.darkGreen, labelGreen)
labelGreen.setGraphicsEffect(aniGreen)
aniGreen.start()
# 红色边框,圆形图片
labelRed = QLabel(self)
labelRed.setMinimumSize(100, 100)
labelRed.setMaximumSize(100, 100)
labelRed.setStyleSheet('border-image: url(Data/1.jpg);border-radius: 50px;')
layout.addWidget(labelRed)
aniRed = AnimationShadowEffect(Qt.red, labelGreen)
labelRed.setGraphicsEffect(aniRed)
aniRed.start()
# 蓝色边框按钮
button = QPushButton('按钮', self)
aniButton = AnimationShadowEffect(Qt.blue, button)
layout.addWidget(button)
button.setGraphicsEffect(aniButton)
button.clicked.connect(aniButton.stop) # 按下按钮停止动画
aniButton.start()
# 青色边框输入框
lineedit = QLineEdit(self)
aniEdit = AnimationShadowEffect(Qt.cyan, lineedit)
layout.addWidget(lineedit)
lineedit.setGraphicsEffect(aniEdit)
aniEdit.start()
示例7: onItemActivated
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import blue [as 别名]
def onItemActivated(self, item):
self.resultView.appendHtml(
'{0}: {1}'.format(
formatColor('itemActivated', QColor(Qt.blue)), item.text()))
示例8: _setType
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import blue [as 别名]
def _setType(self, type_):
self.__type = type_
if self.__type == 1:
self.color = Qt.darkGreen
else: ## TODO: else -> elif ... + else raise exception
self.color = Qt.blue
self.text.setDefaultTextColor(self.color)
pen = self.pen()
pen.setColor(self.color)
self.setPen(pen)
示例9: add_point
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import blue [as 别名]
def add_point(point):
global w
if w.input_clip:
w.pen.setColor(black)
if w.point_now_clip is None:
w.point_now_clip = point
w.point_lock_clip = point
add_row(w.table_rect)
i = w.table_rect.rowCount() - 1
item_x = QTableWidgetItem("{0}".format(point.x()))
item_y = QTableWidgetItem("{0}".format(point.y()))
w.table_rect.setItem(i, 0, item_x)
w.table_rect.setItem(i, 1, item_y)
else:
w.clip.append(point)
w.point_now_clip = point
add_row(w.table_rect)
i = w.table_rect.rowCount() - 1
item_x = QTableWidgetItem("{0}".format(point.x()))
item_y = QTableWidgetItem("{0}".format(point.y()))
w.table_rect.setItem(i, 0, item_x)
w.table_rect.setItem(i, 1, item_y)
item_x = w.table_rect.item(i-1, 0)
item_y = w.table_rect.item(i-1, 1)
w.scene.addLine(point.x(), point.y(), float(item_x.text()), float(item_y.text()), w.pen)
if w.input_pol:
w.pen.setColor(blue)
if w.point_now_pol is None:
w.point_now_pol = point
w.point_lock_pol = point
add_row(w.table_pol)
i = w.table_pol.rowCount() - 1
item_x = QTableWidgetItem("{0}".format(point.x()))
item_y = QTableWidgetItem("{0}".format(point.y()))
w.table_pol.setItem(i, 0, item_x)
w.table_pol.setItem(i, 1, item_y)
else:
w.pol.append(point)
w.point_now_pol = point
add_row(w.table_pol)
i = w.table_pol.rowCount() - 1
item_x = QTableWidgetItem("{0}".format(point.x()))
item_y = QTableWidgetItem("{0}".format(point.y()))
w.table_pol.setItem(i, 0, item_x)
w.table_pol.setItem(i, 1, item_y)
item_x = w.table_pol.item(i-1, 0)
item_y = w.table_pol.item(i-1, 1)
w.scene.addLine(point.x(), point.y(), float(item_x.text()), float(item_y.text()), w.pen)
示例10: setupSimpleDemo
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import blue [as 别名]
def setupSimpleDemo(self):
self.demoName = "Simple Demo"
# add two new graphs and set their look:
self.customPlot.addGraph()
self.customPlot.graph(0).setPen(QPen(QColor("blue"))) # line color blue for first graph
self.customPlot.graph(0).setBrush(QBrush(QColor(0, 0, 255, 20))) # first graph will be filled with translucent blue
self.customPlot.addGraph();
self.customPlot.graph(1).setPen(QPen(QColor("red"))) # line color red for second graph
# generate some points of data (y0 for first, y1 for second graph):
x = [0.0] * 251
y0 = [0.0] * 251
y1 = [0.0] * 251
for i in range(0, 251):
x[i] = float(i)
y0[i] = pow(math.e, -i/150.0) * math.cos(i/10.0) # exponentially decaying cosine
y1[i] = pow(math.e, -i/150.0) # exponential envelope
# configure right and top axis to show ticks but no labels:
# (see QCPAxisRect::setupFullAxesBox for a quicker method to do this)
self.customPlot.xAxis2.setVisible(True)
self.customPlot.xAxis2.setTickLabels(False)
self.customPlot.yAxis2.setVisible(True)
self.customPlot.yAxis2.setTickLabels(False)
# make left and bottom axes always transfer their ranges to right and top axes:
self.customPlot.xAxis.rangeChanged.connect(self.customPlot.xAxis2.setRange)
self.customPlot.yAxis.rangeChanged.connect(self.customPlot.yAxis2.setRange)
# pass data points to graphs:
self.customPlot.graph(0).setData(x, y0)
self.customPlot.graph(1).setData(x, y1)
# let the ranges scale themselves so graph 0 fits perfectly in the visible area:
self.customPlot.graph(0).rescaleAxes()
# same thing for graph 1, but only enlarge ranges (in case graph 1 is smaller than graph 0):
self.customPlot.graph(1).rescaleAxes(True)
# Note: we could have also just called customPlot->rescaleAxes(); instead
# Allow user to drag axis ranges with mouse, zoom with mouse wheel and select graphs by clicking:
# TODO: figure out how to skip the explicit intermediate QCP.Interactions
self.customPlot.setInteractions(QCustomPlot.QCP.Interactions(QCP.iRangeDrag | QCP.iRangeZoom | QCP.iSelectPlottables))
# void setupSincScatterDemo(QCustomPlot *customPlot);
# void setupScatterStyleDemo(QCustomPlot *customPlot);
# void setupLineStyleDemo(QCustomPlot *customPlot);
# void setupScatterPixmapDemo(QCustomPlot *customPlot);
# void setupDateDemo(QCustomPlot *customPlot);
# void setupTextureBrushDemo(QCustomPlot *customPlot);
# void setupMultiAxisDemo(QCustomPlot *customPlot);
# void setupLogarithmicDemo(QCustomPlot *customPlot);
# void setupRealtimeDataDemo(QCustomPlot *customPlot);
示例11: setupParametricCurveDemo
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import blue [as 别名]
def setupParametricCurveDemo(self):
self.demoName = "Parametric Curves Demo"
# create empty curve objects. As they are not adopted by main QCustomPlot an explicit
# reference must be kept
self.fermatSpiral1 = QCustomPlot.QCPCurve(self.customPlot.xAxis, self.customPlot.yAxis)
self.fermatSpiral2 = QCustomPlot.QCPCurve(self.customPlot.xAxis, self.customPlot.yAxis)
self.deltoidRadial = QCustomPlot.QCPCurve(self.customPlot.xAxis, self.customPlot.yAxis)
# generate the curve data points:
pointCount = 501
dataSpiral1 = [[0.0] * pointCount, [0.0] * pointCount, [0.0] * pointCount]
dataSpiral2 = [[0.0] * pointCount, [0.0] * pointCount, [0.0] * pointCount]
dataDeltoid = [[0.0] * pointCount, [0.0] * pointCount, [0.0] * pointCount]
for i in range(0, pointCount):
phi = i/(pointCount-1) * 8 * math.pi
theta = i/(pointCount-1) * 2 * math.pi
dataSpiral1[0][i] = float(i)
dataSpiral1[1][i] = math.sqrt(phi) * math.cos(phi)
dataSpiral1[2][i] = math.sqrt(phi) * math.sin(phi)
dataSpiral2[0][i] = float(i)
dataSpiral2[1][i] = -dataSpiral1[1][i]
dataSpiral2[2][i] = -dataSpiral1[2][i]
dataDeltoid[0][i] = float(i)
dataDeltoid[1][i] = 2 * math.cos(2*theta) + math.cos(1*theta) + 2 * math.sin(theta)
dataDeltoid[2][i] = 2 * math.sin(2*theta) - math.sin(1*theta)
# pass the data to the curves; we know t (i in loop above) is ascending, so set alreadySorted=true (saves an extra internal sort):
self.fermatSpiral1.setData(dataSpiral1[0], dataSpiral1[1], dataSpiral1[2], True)
self.fermatSpiral2.setData(dataSpiral2[0], dataSpiral2[1], dataSpiral2[2], True)
self.deltoidRadial.setData(dataDeltoid[0], dataDeltoid[1], dataDeltoid[2], True)
# color the curves:
self.fermatSpiral1.setPen(QPen(Qt.blue))
self.fermatSpiral1.setBrush(QBrush(QColor(0, 0, 255, 20)))
self.fermatSpiral2.setPen(QPen(QColor(255, 120, 0)))
self.fermatSpiral2.setBrush(QBrush(QColor(255, 120, 0, 30)))
radialGrad = QRadialGradient(QPointF(310, 180), 200)
radialGrad.setColorAt(0, QColor(170, 20, 240, 100))
radialGrad.setColorAt(0.5, QColor(20, 10, 255, 40))
radialGrad.setColorAt(1, QColor(120, 20, 240, 10))
self.deltoidRadial.setPen(QPen(QColor(170, 20, 240)))
self.deltoidRadial.setBrush(QBrush(radialGrad))
# set some basic customPlot config:
self.customPlot.setInteractions(QCustomPlot.QCP.Interactions(QCustomPlot.QCP.iRangeDrag | QCustomPlot.QCP.iRangeZoom | QCustomPlot.QCP.iSelectPlottables))
self.customPlot.axisRect().setupFullAxesBox()
self.customPlot.rescaleAxes()
#~ def setupParametricCurveDemo(self):
示例12: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import blue [as 别名]
def __init__(self, *args, **kwargs):
super(ButtonsWidget, self).__init__(*args, **kwargs)
layout = QGridLayout(self)
loader = CIconLoader.fontMaterial()
# 创建一个多态的icon
icon = loader.icon('mdi-qqchat')
icon.add('mdi-access-point', Qt.red, QIcon.Normal, QIcon.On)
icon.add('mdi-camera-metering-matrix',
Qt.green, QIcon.Disabled, QIcon.Off)
icon.add('mdi-file-document-box-check',
Qt.blue, QIcon.Disabled, QIcon.On)
icon.add('mdi-magnify-minus', Qt.cyan, QIcon.Active, QIcon.Off)
icon.add('mdi-account', Qt.magenta, QIcon.Active, QIcon.On)
icon.add('mdi-camera-off', Qt.yellow, QIcon.Selected, QIcon.Off)
icon.add('mdi-set-center', Qt.white, QIcon.Selected, QIcon.On)
layout.addWidget(QLabel('Normal', self), 0, 0)
layout.addWidget(QPushButton(self, icon=icon, text=loader.value(
'mdi-qqchat'), font=loader.font, iconSize=QSize(36, 36)), 0, 1)
layout.addWidget(QLabel('Disabled', self), 1, 0)
layout.addWidget(QPushButton(self, icon=icon, text=loader.value(
'mdi-qqchat'), enabled=False, font=loader.font, iconSize=QSize(48, 48)), 1, 1)
layout.addWidget(QLabel('Active', self), 2, 0)
layout.addWidget(QPushButton(self, icon=icon, text=loader.value(
'mdi-qqchat'), font=loader.font, iconSize=QSize(64, 64)), 2, 1)
layout.addWidget(QLabel('Selected', self), 3, 0)
layout.addWidget(QPushButton(self, icon=icon, text=loader.value(
'mdi-qqchat'), font=loader.font, checkable=True, checked=True), 3, 1)
# 旋转动画
aniButton = QPushButton(self, iconSize=QSize(48, 48))
loader = CIconLoader.fontAwesome()
icon = loader.icon(
'fa-spinner', animation=CIconAnimationSpin(aniButton, 10, 4))
aniButton.setIcon(icon)
layout.addWidget(QLabel('动画', self), 4, 0)
layout.addWidget(aniButton, 4, 1)
示例13: crearGraficoBarras
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import blue [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