当前位置: 首页>>代码示例>>Python>>正文


Python QtWidgets.QLCDNumber方法代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QLCDNumber方法的典型用法代码示例。如果您正苦于以下问题:Python QtWidgets.QLCDNumber方法的具体用法?Python QtWidgets.QLCDNumber怎么用?Python QtWidgets.QLCDNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWidgets的用法示例。


在下文中一共展示了QtWidgets.QLCDNumber方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: init_ui

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QLCDNumber [as 别名]
def init_ui(self):
        """Setup control widget UI."""
        self.control_layout = QHBoxLayout()
        self.setLayout(self.control_layout)
        self.reset_button = QPushButton()
        self.reset_button.setFixedSize(40, 40)
        self.reset_button.setIcon(QtGui.QIcon(WIN_PATH))
        self.game_timer = QLCDNumber()
        self.game_timer.setStyleSheet("QLCDNumber {color: red;}")
        self.game_timer.setFixedWidth(100)
        self.move_counter = QLCDNumber()
        self.move_counter.setStyleSheet("QLCDNumber {color: red;}")
        self.move_counter.setFixedWidth(100)

        self.control_layout.addWidget(self.game_timer)
        self.control_layout.addWidget(self.reset_button)
        self.control_layout.addWidget(self.move_counter) 
开发者ID:duguyue100,项目名称:minesweeper,代码行数:19,代码来源:gui.py

示例2: setupUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QLCDNumber [as 别名]
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(240, 135)
        self.lcdNumber = QtWidgets.QLCDNumber(Dialog)
        self.lcdNumber.setGeometry(QtCore.QRect(60, 40, 100, 40))
        self.lcdNumber.setObjectName("lcdNumber")

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog) 
开发者ID:PacktPublishing,项目名称:Qt5-Python-GUI-Programming-Cookbook,代码行数:11,代码来源:demoLCD.py

示例3: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QLCDNumber [as 别名]
def __init__(self):
        """MainWindow constructor.

        This widget will be our main window.
        We'll define all the UI components in here.
        """
        super().__init__()
        # Main UI code goes here
        self.setLayout(qtw.QVBoxLayout())
        lcd = qtw.QLCDNumber(self)
        self.layout().addWidget(lcd)

        history = qtw.QLineEdit(self, placeholderText='History')
        self.layout().addWidget(history)

        button_texts = [
            'Clear', 'BackSpace', 'Mem', 'Mem Clear',
            '1', '2', '3', '+',
            '4', '5', '6', '-',
            '7', '8', '9', '×',
            '.', '0', '=', '÷'
        ]
        button_layout = qtw.QGridLayout()
        self.layout().addLayout(button_layout)
        buttons = []
        for num, button_text in enumerate(button_texts):
            button = qtw.QPushButton(button_text, self)
            button.setSizePolicy(qtw.QSizePolicy.Expanding, qtw.QSizePolicy.Expanding)
            buttons.append(button)
            row = num // 4
            column = num % 4
            button_layout.addWidget(button, row, column)
        # End main UI code
        self.show() 
开发者ID:PacktPublishing,项目名称:Mastering-GUI-Programming-with-Python,代码行数:36,代码来源:calculator_form.py

示例4: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QLCDNumber [as 别名]
def __init__(self):
        super().__init__()

        # Create widget and style it
        widget = qtw.QWidget()
        widget.setLayout(qtw.QFormLayout())
        self.setCentralWidget(widget)
        p = widget.palette()
        p.setColor(qtg.QPalette.WindowText, qtg.QColor('cyan'))
        p.setColor(qtg.QPalette.Window, qtg.QColor('navy'))
        p.setColor(qtg.QPalette.Button, qtg.QColor('#335'))
        p.setColor(qtg.QPalette.ButtonText, qtg.QColor('cyan'))
        self.setPalette(p)

        # Create readouts for temperature and humidity
        tempview = qtw.QLCDNumber()
        humview = qtw.QLCDNumber()
        tempview.setSegmentStyle(qtw.QLCDNumber.Flat)
        humview.setSegmentStyle(qtw.QLCDNumber.Flat)
        widget.layout().addRow('Temperature', tempview)
        widget.layout().addRow('Humidity', humview)

        # Create sensor in its own thread
        self.sensor = SensorInterface(4, SENSOR_MODEL, True)
        self.sensor_thread = qtc.QThread()
        self.sensor.moveToThread(self.sensor_thread)
        self.sensor_thread.start()

        # Connect sensor output
        self.sensor.temperature.connect(tempview.display)
        self.sensor.humidity.connect(humview.display)
        self.sensor.read_time.connect(self.show_time)

        # Connect sensor controls
        self.timer = qtc.QTimer(interval=(60000))
        self.timer.timeout.connect(self.sensor.take_reading)
        self.timer.start()

        # Add a Qt button for reading the values
        readbutton = qtw.QPushButton('Read Now')
        widget.layout().addRow(readbutton)
        readbutton.clicked.connect(self.sensor.take_reading)

        # Add hardware button
        self.hwbutton = HWButton(18)
        self.hwbutton.button_press.connect(self.sensor.take_reading)

        self.show() 
开发者ID:PacktPublishing,项目名称:Mastering-GUI-Programming-with-Python,代码行数:50,代码来源:temp_humid_display.py

示例5: setupUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QLCDNumber [as 别名]
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(1053, 761)
        self.label = QtWidgets.QLabel(Form)
        self.label.setGeometry(QtCore.QRect(240, 20, 551, 171))
        self.label.setObjectName("label")
        self.dial = QtWidgets.QDial(Form)
        self.dial.setGeometry(QtCore.QRect(670, 310, 131, 81))
        self.dial.setObjectName("dial")
        self.layoutWidget = QtWidgets.QWidget(Form)
        self.layoutWidget.setGeometry(QtCore.QRect(240, 230, 194, 230))
        self.layoutWidget.setObjectName("layoutWidget")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.layoutWidget)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout.setObjectName("verticalLayout")
        self.label_2 = QtWidgets.QLabel(self.layoutWidget)
        self.label_2.setObjectName("label_2")
        self.verticalLayout.addWidget(self.label_2)
        self.label_3 = QtWidgets.QLabel(self.layoutWidget)
        self.label_3.setObjectName("label_3")
        self.verticalLayout.addWidget(self.label_3)
        self.label_4 = QtWidgets.QLabel(self.layoutWidget)
        self.label_4.setObjectName("label_4")
        self.verticalLayout.addWidget(self.label_4)
        self.layoutWidget1 = QtWidgets.QWidget(Form)
        self.layoutWidget1.setGeometry(QtCore.QRect(470, 230, 191, 231))
        self.layoutWidget1.setObjectName("layoutWidget1")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.layoutWidget1)
        self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.ledT = QtWidgets.QLCDNumber(self.layoutWidget1)
        self.ledT.setObjectName("ledT")
        self.verticalLayout_2.addWidget(self.ledT)
        self.ledE = QtWidgets.QLCDNumber(self.layoutWidget1)
        self.ledE.setObjectName("ledE")
        self.verticalLayout_2.addWidget(self.ledE)
        self.ledH = QtWidgets.QLCDNumber(self.layoutWidget1)
        self.ledH.setObjectName("ledH")
        self.verticalLayout_2.addWidget(self.ledH)

        self.retranslateUi(Form)
        self.dial.valueChanged['int'].connect(self.ledE.display)
        QtCore.QMetaObject.connectSlotsByName(Form) 
开发者ID:copie,项目名称:dayworkspace,代码行数:45,代码来源:tp.py


注:本文中的PyQt5.QtWidgets.QLCDNumber方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。