当前位置:网站首页>[Qt5 basics] random number display

[Qt5 basics] random number display

2022-07-01 01:32:00 Teacher Detian

Display random numbers through a display similar to a calculator

  1. Exercise layout
  2. Practice defining buttons
  3. Practice button signals
  4. Practice using the display

Constructors

 Insert picture description here

Window appearance

 Insert picture description here

Slot function

 Insert picture description here

from PyQt5.Qt import *
import sys
app = QApplication([])
class Window(QWidget):
    def __init__(self):
        super().__init__()
        self.setWindowTitle('QLCDNumber usage ')
        self.resize(300,150)
        self.setup_ui()
    def setup_ui(self):
        vbox = QVBoxLayout()
        self.lcd = QLCDNumber()
        self.lcd.setStyleSheet('background-color:yellow')
        vbox.addWidget(self.lcd)
        self.btn = QPushButton('rando
原网站

版权声明
本文为[Teacher Detian]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/182/202207010035513497.html