Python PyQt5.QtWidgets.QLCDNumber() Examples

The following are 5 code examples of PyQt5.QtWidgets.QLCDNumber(). 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.QtWidgets , or try the search function .
Example #1
Source File: gui.py    From minesweeper with MIT License 5 votes vote down vote up
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) 
Example #2
Source File: demoLCD.py    From Qt5-Python-GUI-Programming-Cookbook with MIT License 5 votes vote down vote up
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) 
Example #3
Source File: calculator_form.py    From Mastering-GUI-Programming-with-Python with MIT License 5 votes vote down vote up
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() 
Example #4
Source File: temp_humid_display.py    From Mastering-GUI-Programming-with-Python with MIT License 4 votes vote down vote up
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() 
Example #5
Source File: tp.py    From dayworkspace with GNU Lesser General Public License v3.0 4 votes vote down vote up
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)