Python PyQt5.QtCore.Qt.AlignVCenter() Examples
The following are 30
code examples of PyQt5.QtCore.Qt.AlignVCenter().
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: lyric.py From FeelUOwn with GNU General Public License v3.0 | 7 votes |
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)
Example #2
Source File: main.py From controleEstoque with MIT License | 6 votes |
def TabelaEntrega(self, tabela, row, col, data, cor, status): item = QtWidgets.QLabel() item.setAlignment(Qt.AlignLeading|Qt.AlignHCenter| Qt.AlignVCenter) item.setIndent(3) item.setMargin(0) item.setStyleSheet("background: #FFF") html = (""" <strong style="font-family:Arial; font-size: 13px;">{}<br/> <span style="color:{}; font-size: 12px">{}</span></strong>""" ).format(data, cor, status) item.setText(html) tabela.setCellWidget(row, col, item) # Texto Tabela Valor Produtos
Example #3
Source File: LogBlockTab.py From crazyflie-clients-python with GNU General Public License v2.0 | 6 votes |
def data(self, index, role): """Re-implemented method to get the data for a given index and role""" node = index.internalPointer() parent = node.parent if parent: if role == Qt.DisplayRole and index.column() == 5: return node.name elif not parent and role == Qt.DisplayRole and index.column() == 5: return node.var_list() elif not parent and role == Qt.DisplayRole: if index.column() == 0: return node.id if index.column() == 1: return node.name if index.column() == 2: return str(node.period) if role == Qt.TextAlignmentRole and \ (index.column() == 4 or index.column() == 3): return Qt.AlignHCenter | Qt.AlignVCenter return None
Example #4
Source File: CFontIcon.py From CustomWidgets with GNU General Public License v3.0 | 6 votes |
def paint(self, painter, rect, mode, state): painter.save() self.font.setPixelSize(round(0.875 * min(rect.width(), rect.height()))) painter.setFont(self.font) if self.icon: if self.icon.animation: self.icon.animation.paint(painter, rect) ms = self.icon._getMode(mode) * self.icon._getState(state) text, color = self.icon.icons.get(ms, (None, None)) if text == None and color == None: return painter.setPen(color) self.text = text if text else self.text painter.drawText( rect, int(Qt.AlignCenter | Qt.AlignVCenter), self.text) painter.restore()
Example #5
Source File: view.py From equant with GNU General Public License v2.0 | 6 votes |
def updateValue(self, strategyId, dataDict): """更新策略ID对应的运行数据""" colValues = { 8: "{:.2f}".format(dataDict["Available"]), 9: "{:.2f}".format(dataDict["MaxRetrace"]), 10: "{:.2f}".format(dataDict["NetProfit"]), 11: "{:.2f}".format(dataDict["WinRate"]) } row = self.get_row_from_strategy_id(strategyId) if row != -1: for k, v in colValues.items(): try: item = QTableWidgetItem(str(v)) if isinstance(eval(v), int) or isinstance(eval(v), float): item.setTextAlignment(Qt.AlignRight | Qt.AlignVCenter) elif isinstance(eval(v), str): item.setTextAlignment(Qt.AlignCenter) self.strategy_table.setItem(row, k, item) except Exception as e: self._logger.error(f"[UI][{strategyId}]: 更新策略执行数据时出错,执行列表中该策略已删除!")
Example #6
Source File: view.py From equant with GNU General Public License v2.0 | 6 votes |
def addExecute(self, dataDict): values = self._formatMonitorInfo(dataDict) if not values: return strategyId = dataDict["StrategyId"] strategy_id_list = self.get_run_strategy_id() try: if strategyId in strategy_id_list: self.updateRunStage(strategyId, dataDict[5]) return except Exception as e: self._logger.warn("addExecute exception") else: row = self.strategy_table.rowCount() self.strategy_table.setRowCount(row + 1) for j in range(len(values)): item = QTableWidgetItem(str(values[j])) if isinstance(values[j], int) or isinstance(values[j], float): item.setTextAlignment(Qt.AlignRight | Qt.AlignVCenter) elif isinstance(values[j], str): item.setTextAlignment(Qt.AlignCenter) self.strategy_table.setItem(row, j, item)
Example #7
Source File: VerificationCode.py From PyQt with GNU General Public License v3.0 | 6 votes |
def __init__(self, *args, **kwargs): super(WidgetCode, self).__init__(*args, **kwargs) self._sensitive = False # 是否大小写敏感 self.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter) self.setBackgroundRole(QPalette.Midlight) self.setAutoFillBackground(True) # 字体 newFont = self.font() newFont.setPointSize(16) newFont.setFamily("Kristen ITC") newFont.setBold(True) self.setFont(newFont) self.reset() # 定时器 self.step = 0 self.timer = QBasicTimer() self.timer.start(60, self)
Example #8
Source File: roast_properties.py From artisan with GNU General Public License v3.0 | 5 votes |
def defineBatchEditor(self): self.batchprefixedit = QLineEdit(self.aw.qmc.roastbatchprefix) self.batchcounterSpinBox = QSpinBox() self.batchcounterSpinBox.setRange(0,999999) self.batchcounterSpinBox.setSingleStep(1) self.batchcounterSpinBox.setValue(self.aw.qmc.roastbatchnr) self.batchcounterSpinBox.setAlignment(Qt.AlignRight|Qt.AlignTrailing|Qt.AlignVCenter) self.batchposSpinBox = QSpinBox() self.batchposSpinBox.setRange(1,99) self.batchposSpinBox.setSingleStep(1) self.batchposSpinBox.setValue(self.aw.qmc.roastbatchpos) self.batchposSpinBox.setAlignment(Qt.AlignRight|Qt.AlignTrailing|Qt.AlignVCenter) self.batchLayout.addWidget(self.batchprefixedit) self.batchLayout.addWidget(self.batchcounterSpinBox) self.batchLayout.addWidget(self.batchposSpinBox)
Example #9
Source File: pkwidgets.py From pkmeter with BSD 3-Clause "New" or "Revised" License | 5 votes |
def paint_slider_on(self, painter): swidth = int((self.width() / 2) - 2) sheight = int(self.height() - 2) painter.setBrush(QtGui.QBrush(QtGui.QColor(60,90,150,200))) painter.drawRoundedRect(self.contentsRect(), 3, 3) painter.setBrush(QtGui.QBrush(self.bgcolor_slider)) painter.drawRoundedRect(swidth+3, 1, swidth, sheight, 2, 2) painter.setPen(QtGui.QColor(255,255,255,220)) painter.drawText(2, 1, swidth, sheight, Qt.AlignCenter | Qt.AlignVCenter, 'On')
Example #10
Source File: setpwd.py From lanzou-gui with MIT License | 5 votes |
def initUI(self): self.setWindowTitle("请稍等……") self.setWindowIcon(QIcon(SRC_DIR + "password.ico")) self.lb_oldpwd = QLabel() self.lb_oldpwd.setText("当前提取码:") self.lb_oldpwd.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self.tx_oldpwd = QLineEdit() # 当前提取码 只读 self.tx_oldpwd.setFocusPolicy(Qt.NoFocus) self.tx_oldpwd.setReadOnly(True) self.lb_newpwd = QLabel() self.lb_newpwd.setText("新的提取码:") self.lb_newpwd.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self.tx_newpwd = QLineEdit() self.buttonBox = QDialogButtonBox() self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.buttonBox.button(QDialogButtonBox.Ok).setText("确定") self.buttonBox.button(QDialogButtonBox.Cancel).setText("取消") self.grid = QGridLayout() self.grid.setSpacing(10) self.grid.addWidget(self.lb_oldpwd, 1, 0) self.grid.addWidget(self.tx_oldpwd, 1, 1) self.grid.addWidget(self.lb_newpwd, 2, 0) self.grid.addWidget(self.tx_newpwd, 2, 1) self.grid.addWidget(self.buttonBox, 3, 0, 1, 2) self.setLayout(self.grid) self.buttonBox.accepted.connect(self.btn_ok) self.buttonBox.accepted.connect(self.accept) self.buttonBox.accepted.connect(self.set_tip) self.buttonBox.rejected.connect(self.reject) self.buttonBox.rejected.connect(self.set_tip) self.setMinimumWidth(280)
Example #11
Source File: rename.py From lanzou-gui with MIT License | 5 votes |
def initUI(self): self.setWindowIcon(QIcon(SRC_DIR + "desc.ico")) self.lb_name = QLabel() self.lb_name.setText("文件夹名:") self.lb_name.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self.tx_name = QLineEdit() self.lb_desc = QLabel() self.tx_desc = QTextEdit() self.lb_desc.setText("描 述:") self.lb_desc.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self.buttonBox = QDialogButtonBox() self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.buttonBox.button(QDialogButtonBox.Ok).setText("确定") self.buttonBox.button(QDialogButtonBox.Cancel).setText("取消") self.grid = QGridLayout() self.grid.setSpacing(10) self.grid.addWidget(self.lb_name, 1, 0) self.grid.addWidget(self.tx_name, 1, 1) self.grid.addWidget(self.lb_desc, 2, 0) self.grid.addWidget(self.tx_desc, 2, 1, 5, 1) self.grid.addWidget(self.buttonBox, 7, 1, 1, 1) self.setLayout(self.grid) self.buttonBox.accepted.connect(self.btn_ok) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject)
Example #12
Source File: move.py From lanzou-gui with MIT License | 5 votes |
def initUI(self): self.setWindowTitle("移动文件(夹)") self.setWindowIcon(QIcon(SRC_DIR + "move.ico")) self.lb_name = QLabel() self.lb_name.setText("文件(夹)名:") self.lb_name.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self.tx_name = AutoResizingTextEdit() self.tx_name.setFocusPolicy(Qt.NoFocus) # 只读 self.tx_name.setReadOnly(True) self.lb_new_path = QLabel() self.lb_new_path.setText("目标文件夹:") self.lb_new_path.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self.tx_new_path = QComboBox() self.buttonBox = QDialogButtonBox() self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.buttonBox.button(QDialogButtonBox.Ok).setText("确定") self.buttonBox.button(QDialogButtonBox.Cancel).setText("取消") self.grid = QGridLayout() self.grid.setSpacing(10) self.grid.addWidget(self.lb_name, 1, 0) self.grid.addWidget(self.tx_name, 1, 1) self.grid.addWidget(self.lb_new_path, 2, 0) self.grid.addWidget(self.tx_new_path, 2, 1) self.grid.addWidget(self.buttonBox, 3, 0, 1, 2) self.setLayout(self.grid) self.buttonBox.accepted.connect(self.btn_ok) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject) self.setMinimumWidth(280)
Example #13
Source File: gui.py From lanzou-gui with MIT License | 5 votes |
def update_rec_lists(self, dir_lists, file_lists): """显示回收站文件和文件夹列表""" self.model_rec.removeRows(0, self.model_rec.rowCount()) # 清理旧的内容 file_count = len(file_lists) folder_count = len(dir_lists) if ((not dir_lists) and (not file_lists)) or (file_count == 0 and folder_count == 0): self.show_status("回收站为空!", 4000) return name_header = ["文件夹{}个".format(folder_count), ] if folder_count else [] if file_count: name_header.append("文件{}个".format(file_count)) self.model_rec.setHorizontalHeaderLabels(["/".join(name_header), "大小", "时间"]) folder_ico = QIcon(SRC_DIR + "folder.gif") for item in iter(dir_lists): # 文件夹 name = QStandardItem(folder_ico, item.name) name.setData(item) name.setToolTip("双击查看详情") size_ = QStandardItem(item.size) time_ = QStandardItem(item.time) self.model_rec.appendRow([name, size_, time_]) for item in iter(file_lists): # 文件 name = QStandardItem(set_file_icon(item.name), item.name) name.setData(item) size_ = QStandardItem(item.size) time_ = QStandardItem(item.time) self.model_rec.appendRow([name, size_, time_]) for row in range(self.model_rec.rowCount()): # 右对齐 self.model_rec.item(row, 1).setTextAlignment(Qt.AlignRight | Qt.AlignVCenter) self.model_rec.item(row, 2).setTextAlignment(Qt.AlignRight | Qt.AlignVCenter)
Example #14
Source File: code_editor.py From Dwarf with GNU General Public License v3.0 | 5 votes |
def draw_line_numbers(self, event): painter = QPainter(self.ui_line_numbers) # background painter.fillRect(event.rect(), Qt.transparent) # linenums current_block = self.firstVisibleBlock() block_num = current_block.blockNumber() top = self.blockBoundingGeometry(current_block).translated( self.contentOffset()).top() bottom = top + self.blockBoundingRect(current_block).height() while current_block.isValid() and (top <= event.rect().bottom()): if current_block.isVisible() and (bottom >= event.rect().top()): s = ("{0}".format(block_num + 1)) painter.setPen(QColor('#636d83')) painter.setFont(self.font()) painter.drawText(0, top, self.calculated_linenum_width() - 5, self.fontMetrics().height(), Qt.AlignRight | Qt.AlignVCenter, s) current_block = current_block.next() top = bottom bottom = top + self.blockBoundingRect(current_block).height() block_num += 1
Example #15
Source File: ChatWidget.py From PyQt with GNU General Public License v3.0 | 5 votes |
def __init__(self, *args, **kwargs): super(LoadingWidget, self).__init__(*args, **kwargs) self.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter) self._movie = QMovie("loading.gif") self.setMovie(self._movie)
Example #16
Source File: {{cookiecutter.application_name}}.py From cookiecutter-pyqt5 with MIT License | 5 votes |
def __init__(self, parent=None): """Display a dialog that shows application information.""" super(AboutDialog, self).__init__(parent) self.setWindowTitle('About') help_icon = pkg_resources.resource_filename('{{ cookiecutter.package_name }}.images', 'ic_help_black_48dp_1x.png') self.setWindowIcon(QIcon(help_icon)) self.resize(300, 200) author = QLabel('{{ cookiecutter.full_name }}') author.setAlignment(Qt.AlignCenter) icons = QLabel('Material design icons created by Google') icons.setAlignment(Qt.AlignCenter) github = QLabel('GitHub: {{ cookiecutter.github_username }}') github.setAlignment(Qt.AlignCenter) self.layout = QVBoxLayout() self.layout.setAlignment(Qt.AlignVCenter) self.layout.addWidget(author) self.layout.addWidget(icons) self.layout.addWidget(github) self.setLayout(self.layout)
Example #17
Source File: frameless.py From FeelUOwn with GNU General Public License v3.0 | 5 votes |
def paintEvent(self, e): painter = QPainter(self) if self._size_grip.isVisible(): painter.save() painter.setPen(QColor('white')) option = QTextOption() option.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter) rect = QRect(self._size_grip.pos(), self._size_grip.size()) painter.drawText(QRectF(rect), '●', option) painter.restore()
Example #18
Source File: view.py From equant with GNU General Public License v2.0 | 5 votes |
def updateSyncPosition(self, positions): self.pos_table.setRowCount(len(positions)) for i in range(len(positions)): for j in range(len(positions[i])): item = QTableWidgetItem(str(positions[i][j])) if isinstance(positions[i][j], int) or isinstance(positions[i][j], float): item.setTextAlignment(Qt.AlignRight | Qt.AlignVCenter) elif isinstance(positions[i][j], str): item.setTextAlignment(Qt.AlignCenter) self.pos_table.setItem(i, j, item)
Example #19
Source File: main.py From controleEstoque with MIT License | 5 votes |
def conteudoTabela(self, tabela, row, col, data): item = QtWidgets.QTableWidgetItem() item.setTextAlignment(Qt.AlignJustify | Qt.AlignHCenter | Qt.AlignVCenter) item.setFlags(Qt.NoItemFlags) item.setText(data) tabela.setItem(row, col, item) # Conteudo tabela alinhado a esquerda
Example #20
Source File: main.py From controleEstoque with MIT License | 5 votes |
def conteudoTabelaLeft(self, tabela, row, col, data): item = QtWidgets.QTableWidgetItem() item.setTextAlignment(Qt.AlignJustify | Qt.AlignLeft | Qt.AlignVCenter) item.setFlags(Qt.NoItemFlags) item.setText(data) tabela.setItem(row, col, item) # Botão Tabela
Example #21
Source File: main.py From controleEstoque with MIT License | 5 votes |
def ValorProduto(self, tabela, row, col, valor): item = QtWidgets.QLabel() item.setAlignment( Qt.AlignLeading|Qt.AlignHCenter|Qt.AlignVCenter) item.setMargin(0) item.setStyleSheet('background: #FFF') html = (""" <span style="font-family:'Arial'; font-size:30px; font-weight: bold;"> <span style="font-size: 12px">R$</span> {}</span><br/> """).format(valor) item.setText(html) tabela.setCellWidget(row, col, item) # Status Operação coluna 1 tabela Compra/Venda
Example #22
Source File: main.py From controleEstoque with MIT License | 5 votes |
def TabelaNomeTelefone(self, tabela, row, col, nome, telefone): item = QtWidgets.QLabel() item.setAlignment(Qt.AlignLeading|Qt.AlignLeft| Qt.AlignVCenter) item.setIndent(3) item.setMargin(0) item.setStyleSheet('background: #FFF') html = ((""" <span style="font-family:Arial; font-size:13px; ">{}</span><br/> <span style="font-family:Arial; font-size:10px;">{}</span>""" )).format(nome, telefone) item.setText(html) tabela.setCellWidget(row, col, item) # texto quantidade e status produtos tabela Produto
Example #23
Source File: main.py From controleEstoque with MIT License | 5 votes |
def TabelaID(self, tabela, row, col, id): item = QtWidgets.QLabel() item.setAlignment( Qt.AlignLeading|Qt.AlignHCenter|Qt.AlignVCenter) item.setMargin(0) item.setStyleSheet('background: #FFF;') html = (""" <span style="font-family:'Arial'; font-size:30px; font-weight: bold;color:#7AB32E ">{}</span><br/> """).format(id) item.setText(html) tabela.setCellWidget(row, col, item) #Botao Receber/ Pagar Parcela
Example #24
Source File: main.py From controleEstoque with MIT License | 5 votes |
def tx_tabelaReceber(self, tabela, row, col, status, valor): item = QtWidgets.QLineEdit() # item.setGeometry(QRect(310, 360, 80, 30)) # item.setFixedWidth(60) if status == 1: item.setReadOnly(True) item.setText(valor) item.setFocusPolicy(Qt.WheelFocus) item.setStyleSheet("QLineEdit{\n" "background: #F1F1F1;\n" "border: 2px solid #CFCFCF;\n" "color: #000;\n" "font: 12px \"Arial\" ;\n" "text-transform: uppercase;\n" "font-weight: bold\n" "}\n" "QLineEdit:Focus {\n" "border: 1px solid red;\n" "}") item.setAlignment( Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) item.setObjectName("tx_ValorPago") item.setPlaceholderText("R$ 0.00") tabela.setCellWidget(row, col, item) #Input data tabela parcelas
Example #25
Source File: qdelegates.py From linux-show-player with GNU General Public License v3.0 | 5 votes |
def paint(self, painter, option, index): option.displayAlignment = Qt.AlignHCenter | Qt.AlignVCenter super().paint(painter, option, index)
Example #26
Source File: pkwidgets.py From pkmeter with BSD 3-Clause "New" or "Revised" License | 5 votes |
def paint_slider_off(self, painter): swidth = int((self.width() / 2) - 2) sheight = int(self.height() - 2) painter.setBrush(QtGui.QBrush(QtGui.QColor(0,0,0,50))) painter.drawRoundedRect(self.contentsRect(), 3, 3) painter.setBrush(QtGui.QBrush(self.bgcolor_slider)) painter.drawRoundedRect(3, 1, swidth, sheight, 2, 2) painter.setPen(QtGui.QColor(0,0,0,150)) painter.drawText(swidth+3, 1, swidth, sheight, Qt.AlignCenter | Qt.AlignVCenter, 'Off')
Example #27
Source File: player.py From MusicBox with MIT License | 5 votes |
def paintEvent(self, event): painter = QPainter(self) painter.setFont(self.font) linear = QLinearGradient(QPoint(self.rect().topLeft()), QPoint(self.rect().bottomLeft())) linear.setStart(0, 10) linear.setFinalStop(0, 50) linear.setColorAt(0.1, QColor(14, 179, 255)); linear.setColorAt(0.5, QColor(154, 232, 255)); linear.setColorAt(0.9, QColor(14, 179, 255)); linear2 = QLinearGradient(QPoint(self.rect().topLeft()), QPoint(self.rect().bottomLeft())) linear2.setStart(0, 10) linear2.setFinalStop(0, 50) linear2.setColorAt(0.1, QColor(222, 54, 4)); linear2.setColorAt(0.5, QColor(255, 172, 116)); linear2.setColorAt(0.9, QColor(222, 54, 4)); painter.setPen(QColor(0, 0, 0, 200)); painter.drawText(QRect(1, 1, self.screen.width(), 60), Qt.AlignHCenter | Qt.AlignVCenter, self.lyric) painter.setPen(QColor('transparent')); self.textRect = painter.drawText(QRect(0, 0, self.screen.width(), 60), Qt.AlignHCenter | Qt.AlignVCenter, self.lyric) painter.setPen(QPen(linear, 0)) painter.drawText(self.textRect, Qt.AlignLeft | Qt.AlignVCenter, self.lyric) if self.intervel != 0: self.widthBlock = self.textRect.width()/(self.intervel/150.0) else: self.widthBlock = 0 self.maskRect = QRectF(self.textRect.x(), self.textRect.y(), self.textRect.width(), self.textRect.height()) self.maskRect.setWidth(self.maskWidth) painter.setPen(QPen(linear2, 0)); painter.drawText(self.maskRect, Qt.AlignLeft | Qt.AlignVCenter, self.lyric)
Example #28
Source File: battleView.py From imperialism-remake with GNU General Public License v3.0 | 5 votes |
def setup_hint_label(self): size_policy = constants.default_size_policy(self.hintLabel, QSizePolicy.Preferred, QSizePolicy.Fixed) self.hintLabel.setSizePolicy(size_policy) self.hintLabel.setFont(constants.default_font()) self.hintLabel.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self.gridLayout.addWidget(self.hintLabel, 0, 0, 1, 1)
Example #29
Source File: battleView.py From imperialism-remake with GNU General Public License v3.0 | 5 votes |
def setup_turn_label(self): size_policy = constants.default_size_policy(self.dateLabel, QSizePolicy.Preferred, QSizePolicy.Fixed) self.dateLabel.setSizePolicy(size_policy) self.dateLabel.setFont(constants.default_font()) self.dateLabel.setText('Turn ' + str(self.battleView.turn)) self.dateLabel.setAlignment(Qt.AlignLeft | Qt.AlignVCenter) self.gridLayout.addWidget(self.dateLabel, 0, 0, 1, 1)
Example #30
Source File: stimulus_display.py From stytra with GNU General Public License v3.0 | 5 votes |
def __init__(self, experiment, **kwargs): super().__init__(**kwargs) self.experiment = experiment self.container_layout = QVBoxLayout() self.container_layout.setContentsMargins(0, 0, 0, 0) StimDisplay = type("StimDisplay", (StimDisplayWidgetConditional, QWidget), {}) self.widget_display = StimDisplay( self, calibrator=self.experiment.calibrator, protocol_runner=self.experiment.protocol_runner, record_stim_framerate=None, ) self.layout_inner = QVBoxLayout() self.layout_inner.addWidget(self.widget_display) self.button_show_display = QPushButton( "Show stimulus (showing stimulus may impair performance)" ) self.widget_display.display_state = False self.button_show_display.clicked.connect(self.change_button) self.layout_inner.addWidget(self.button_show_display) self.layout_inner.setContentsMargins(12, 0, 12, 12) self.container_layout.addLayout(self.layout_inner) self.setLayout(self.container_layout) self.container_layout.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter) self.widget_display.sizeHint = lambda: QSize(100, 100) sizePolicy = QSizePolicy( QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding ) self.widget_display.setSizePolicy(sizePolicy) self.widget_display.setMaximumSize(500, 500)