本文整理汇总了Python中PyQt5.QtWidgets.QLCDNumber.setMinimumHeight方法的典型用法代码示例。如果您正苦于以下问题:Python QLCDNumber.setMinimumHeight方法的具体用法?Python QLCDNumber.setMinimumHeight怎么用?Python QLCDNumber.setMinimumHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QLCDNumber
的用法示例。
在下文中一共展示了QLCDNumber.setMinimumHeight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Objetives
# 需要导入模块: from PyQt5.QtWidgets import QLCDNumber [as 别名]
# 或者: from PyQt5.QtWidgets.QLCDNumber import setMinimumHeight [as 别名]
class Objetives(QWidget):
NumButtons = 3
def __init__(self, parent=None):
super(Objetives, self).__init__(parent)
self.createDisplay()
self.createDisplayAverage()
self.createButtons()
self.numVictory = 0
self.numLosses = 0
mainLayout = QGridLayout()
mainLayout.addWidget(self.displayLCD)
mainLayout.addWidget(self.horizontalGroupBox)
mainLayout.addWidget(self.displayWinPercent)
self.setLayout(mainLayout)
self.setWindowTitle("Objetives")
def createButtons(self):
self.horizontalGroupBox = QGroupBox("")
layout = QGridLayout()
self.victoryButton = self.createButton("Victory", "+",self.addVictoryOrLosses)
self.lossesButton = self.createButton("Losses", "+",self.addVictoryOrLosses)
self.victoryDecreaseButton = self.createButton("DV","-",self.addVictoryOrLosses)
self.losseDecreaseButton = self.createButton("DL","-",self.addVictoryOrLosses)
self.lossesButton.setMinimumWidth(150)
self.victoryButton.setMinimumWidth(150)
self.losseDecreaseButton.setMaximumHeight(20)
self.victoryDecreaseButton.setMaximumHeight(20)
layout.addWidget(self.victoryButton, 0, 0, 1, 1)
layout.addWidget(self.lossesButton, 0, 2, 1, 1)
layout.addWidget(self.victoryDecreaseButton, 1, 0, 1, 1)
layout.addWidget(self.losseDecreaseButton, 1, 2, 1, 1)
self.horizontalGroupBox.setLayout(layout)
def createDisplayAverage(self):
self.displayWinPercent = QGroupBox("Wins")
layout = QHBoxLayout()
self.progressBar = QProgressBar()
self.progressBar.setRange(0, 100)
# self.progressBar.setValue(5000)
layout.addWidget(self.progressBar)
self.displayWinPercent.setLayout(layout)
def createDisplay(self):
self.displayLCD = QGroupBox("")
layout = QHBoxLayout()
paletteLosses = QPalette()
paletteVictory = QPalette()
paletteLosses.setColor(paletteLosses.WindowText, QColor(255, 000, 000))
paletteVictory.setColor(paletteVictory.WindowText, QColor(000, 255, 000))
self.lossesLcd = QLCDNumber(3)
self.lossesLcd.setSegmentStyle(QLCDNumber.Filled)
self.lossesLcd.setPalette(paletteLosses)
self.victoryLcd = QLCDNumber(3)
self.victoryLcd.setSegmentStyle(QLCDNumber.Filled)
self.victoryLcd.setPalette(paletteVictory)
self.lossesLcd.setMinimumHeight(100)
self.victoryLcd.setMinimumHeight(100)
self.lossesLcd.setMinimumWidth(150)
self.victoryLcd.setMinimumWidth(150)
layout.addWidget(self.victoryLcd)
layout.addWidget(self.lossesLcd)
self.displayLCD.setLayout(layout)
def addVictoryOrLosses(self):
clickedButton = self.sender()
clickedOperator = clickedButton.text()
operand = float(1)
if clickedOperator == "Victory":
self.numVictory = self.numVictory + 1
self.victoryLcd.display(str(self.numVictory))
if clickedOperator == "DV":
self.numVictory = self.numVictory - 1
self.victoryLcd.display(str(self.numVictory))
if clickedOperator == "Losses":
self.numLosses = self.numLosses + 1
#.........这里部分代码省略.........