本文整理汇总了Python中PyQt5.QtCore.Qt.AlignBottom方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.AlignBottom方法的具体用法?Python Qt.AlignBottom怎么用?Python Qt.AlignBottom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.Qt
的用法示例。
在下文中一共展示了Qt.AlignBottom方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init_top_layout
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignBottom [as 别名]
def init_top_layout(self):
history = FIRST.server.history(self.metadata_id)
if (not history
or ('results' not in history)
or (self.metadata_id not in history['results'])
or ('creator' not in history['results'][self.metadata_id])
or ('history' not in history['results'][self.metadata_id])):
self.should_show = False
return
self.creator = history['results'][self.metadata_id]['creator']
self.history = history['results'][self.metadata_id]['history']
title = QtWidgets.QLabel('Revision History')
title.setStyleSheet('font: 16pt;')
creator = QtWidgets.QLabel('by: <b>{}</b>'.format(self.creator))
creator.setAlignment(Qt.AlignRight | Qt.AlignBottom)
self.top_layout.addWidget(title)
self.top_layout.addStretch()
self.top_layout.addWidget(creator)
示例2: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignBottom [as 别名]
def __init__(self, parent=None):
super().__init__(parent=parent)
self._border_radius = 10
self.label = QLabel('...', self)
self._size_grip = QSizeGrip(self)
self._size_grip.setFixedWidth(self._border_radius * 2)
font = self.font()
font.setPointSize(24)
self.label.setFont(font)
self.label.setAlignment(Qt.AlignBaseline | Qt.AlignVCenter | Qt.AlignHCenter)
self.label.setWordWrap(False)
self._layout = QHBoxLayout(self)
self._layout.setContentsMargins(0, 0, 0, 0)
self._layout.setSpacing(0)
self._layout.addSpacing(self._border_radius * 2)
self._layout.addWidget(self.label)
self._layout.addWidget(self._size_grip)
self._layout.setAlignment(self._size_grip, Qt.AlignBottom)
示例3: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignBottom [as 别名]
def __init__(self,):
super().__init__(parent=None)
self._widget = None
self._timer = QTimer(self)
self._old_pos = None
self._widget = None
self._size_grip = QSizeGrip(self)
self._timer.timeout.connect(self.__on_timeout)
# setup window layout
self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint)
self._size_grip.setFixedSize(20, 20)
self._layout = QVBoxLayout(self)
self._layout.setContentsMargins(0, 0, 0, 0)
self._layout.setSpacing(0)
self._layout.addWidget(self._size_grip)
self._layout.setAlignment(self._size_grip, Qt.AlignBottom | Qt.AlignRight)
self.setMouseTracking(True)
示例4: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignBottom [as 别名]
def __init__(self, parent=None):
super(LateralMenu, self).__init__(parent)
self.setLayout(QVBoxLayout())
self.layout().setContentsMargins(0, 0, 0, 0)
self.top_frame = QFrame()
# size_policy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Preferred)
# self.frame.setSizePolicy(size_policy)
# self.top_frame.setFixedWidth(90)
self.top_frame.setFrameStyle(QFrame.NoFrame)
self.top_frame_layout = QVBoxLayout()
self.top_frame_layout.setContentsMargins(2, 2, 2, 2)
self.top_frame_layout.setAlignment(Qt.AlignTop)
self.top_frame.setLayout(self.top_frame_layout)
self.bottom_frame = QFrame()
# self.bottom_frame.setFixedWidth(90)
self.bottom_frame.setFrameStyle(QFrame.NoFrame)
self.bottom_frame_layout = QVBoxLayout()
self.bottom_frame_layout.setContentsMargins(2, 2, 2, 2)
self.bottom_frame_layout.setAlignment(Qt.AlignBottom)
self.bottom_frame.setLayout(self.bottom_frame_layout)
self.layout().addWidget(self.top_frame)
self.layout().addWidget(self.bottom_frame)
self.items = []
示例5: paintEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignBottom [as 别名]
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()))
示例6: init_ui
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignBottom [as 别名]
def init_ui(self, title):
self.setWindowTitle(_(title))
btn_add_mapping = create_button('+ Add colors mapping', self.on_add)
btn_close = create_button('Close', self.close)
buttons = QHBoxLayout()
buttons.addWidget(btn_close)
buttons.addWidget(btn_add_mapping)
buttons.setAlignment(Qt.AlignBottom)
body = QVBoxLayout()
body.setAlignment(Qt.AlignTop)
header = QLabel(_(
'Specify how particular colors on your cards '
'should be swapped when the night mode is on.'
))
header.setAlignment(Qt.AlignCenter)
mappings = QVBoxLayout()
mappings.setAlignment(Qt.AlignTop)
for normal_color, night_color in self.color_map.items():
mapping = ColorMapping(self, normal_color, night_color)
mappings.addWidget(mapping)
self.mappings = mappings
body.addWidget(header)
body.addLayout(mappings)
body.addStretch(1)
body.addLayout(buttons)
self.setLayout(body)
self.setGeometry(300, 300, 350, 300)
self.show()
示例7: populate_form
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignBottom [as 别名]
def populate_form(self):
self.setWindowTitle('mkYARA :: Generated Yara Rule')
self.resize(800, 600)
self.layout = QtWidgets.QVBoxLayout(self)
self.top_layout = QtWidgets.QHBoxLayout()
self.bottom_layout = QtWidgets.QHBoxLayout()
self.bottom_layout.setAlignment(Qt.AlignRight | Qt.AlignBottom)
# layout.addStretch()
self.layout.addWidget(QtWidgets.QLabel("Generated Yara rule from 0x{:x} to 0x{:x}".format(self.start_addr, self.end_addr)))
self.text_edit = QtWidgets.QTextEdit()
font = QtGui.QFont()
font.setFamily("Consolas")
font.setStyleHint(QtGui.QFont.Monospace)
font.setFixedPitch(True)
font.setPointSize(10)
self.text_edit.setFont(font)
metrics = QtGui.QFontMetrics(font)
self.text_edit.setTabStopWidth(4 * metrics.width(' '))
self.text_edit.insertPlainText(self.yara_rule)
self.layout.addWidget(self.text_edit)
self.ok_btn = QtWidgets.QPushButton("OK")
self.ok_btn.setFixedWidth(100)
self.ok_btn.clicked.connect(self.ok_btn_clicked)
self.bottom_layout.addWidget(self.ok_btn)
self.layout.addLayout(self.top_layout)
self.layout.addLayout(self.bottom_layout)
示例8: crearLeyendaCaja
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignBottom [as 别名]
def crearLeyendaCaja(self):
leyendaComboBox = QComboBox()
leyendaComboBox.addItem("No Leyenda", 0)
leyendaComboBox.addItem("Leyenda superior", Qt.AlignTop)
leyendaComboBox.addItem("Leyenda inferior", Qt.AlignBottom)
leyendaComboBox.addItem("Leyenda izquierda", Qt.AlignLeft)
leyendaComboBox.addItem("Leyenda derecha", Qt.AlignRight)
return leyendaComboBox
示例9: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignBottom [as 别名]
def __init__(self, picfile):
pixmap = QPixmap(picfile)
# , Qt.WindowStaysOnTopHint)
super(SplashScreen, self).__init__(pixmap)
# self.setMask(splash_pix.mask())
# self.raise_()
self.labelAlignment = int(Qt.AlignBottom | Qt.AlignHCenter | Qt.AlignAbsolute)
self.show()
QApplication.flush()
示例10: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignBottom [as 别名]
def __init__(self, *args, **kwargs):
super(Window, self).__init__(*args, **kwargs)
self.resize(400, 300)
# 抗锯齿
self.setRenderHint(QPainter.Antialiasing)
# 图表
chart = QChart()
self.setChart(chart)
# 设置标题
chart.setTitle('Simple barchart example')
# 开启动画效果
chart.setAnimationOptions(QChart.SeriesAnimations)
# 添加Series
series = self.getSeries()
chart.addSeries(series)
# 分类
categories = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun']
# 分类x轴
axis = QBarCategoryAxis()
axis.append(categories)
# 创建默认轴线
chart.createDefaultAxes()
# 替换默认x轴
chart.setAxisX(axis, series)
# 显示图例
chart.legend().setVisible(True)
chart.legend().setAlignment(Qt.AlignBottom)
示例11: createLegendBox
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignBottom [as 别名]
def createLegendBox(self):
legendComboBox = QComboBox()
legendComboBox.addItem("No Legend ", 0)
legendComboBox.addItem("Legend Top", Qt.AlignTop)
legendComboBox.addItem("Legend Bottom", Qt.AlignBottom)
legendComboBox.addItem("Legend Left", Qt.AlignLeft)
legendComboBox.addItem("Legend Right", Qt.AlignRight)
return legendComboBox
示例12: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignBottom [as 别名]
def __init__(self, *args, **kwargs):
super(Window, self).__init__(*args, **kwargs)
self.resize(400, 300)
# 抗锯齿
self.setRenderHint(QPainter.Antialiasing)
# 图表
chart = QChart()
self.setChart(chart)
# 设置标题
chart.setTitle('Simple percentbarchart example')
# 开启动画效果
chart.setAnimationOptions(QChart.SeriesAnimations)
# 添加Series
series = self.getSeries()
chart.addSeries(series)
# 分类
categories = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun']
# 分类x轴
axis = QBarCategoryAxis()
axis.append(categories)
# 创建默认轴线
chart.createDefaultAxes()
# 替换默认x轴
chart.setAxisX(axis, series)
# 显示图例
chart.legend().setVisible(True)
chart.legend().setAlignment(Qt.AlignBottom)
示例13: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignBottom [as 别名]
def __init__(self, *args, **kwargs):
super(Window, self).__init__(*args, **kwargs)
self.resize(400, 300)
# 抗锯齿
self.setRenderHint(QPainter.Antialiasing)
# 图表
chart = QChart()
self.setChart(chart)
# 设置标题
chart.setTitle('Simple horizontal barchart example')
# 开启动画效果
chart.setAnimationOptions(QChart.SeriesAnimations)
# 添加Series
series = self.getSeries()
chart.addSeries(series)
# 分类
categories = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun']
# 分类x轴
axis = QBarCategoryAxis()
axis.append(categories)
# 创建默认轴线
chart.createDefaultAxes()
# 替换默认y轴
chart.setAxisY(axis, series)
# 显示图例
chart.legend().setVisible(True)
chart.legend().setAlignment(Qt.AlignBottom)
示例14: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignBottom [as 别名]
def __init__(self):
super().__init__()
self.m_step = 0
self.m_x = 5
self.m_y = 1
# 初始化图像
self.series = QSplineSeries(self)
green_pen = QPen(Qt.red)
green_pen.setWidth(3)
self.series.setPen(green_pen)
self.axisX = QValueAxis()
self.axisY = QValueAxis()
self.series.append(self.m_x, self.m_y)
self.addSeries(self.series)
self.addAxis(self.axisX, Qt.AlignBottom)
self.addAxis(self.axisY, Qt.AlignLeft)
self.series.attachAxis(self.axisX)
self.series.attachAxis(self.axisY)
self.axisX.setTickCount(5)
self.axisX.setRange(0, 10)
self.axisY.setRange(-5, 10)
self.timer = QTimer(self)
self.timer.setInterval(1000)
self.timer.timeout.connect(self.handleTimeout)
self.timer.start()
示例15: paintEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignBottom [as 别名]
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)