通过类似计算器的显示屏展示随机数
- 练习布局
- 练习定义按钮
- 练习按钮信号
- 练习显示屏用法
构造函数
窗口外观
槽函数
from PyQt5.Qt import *
import sys
app = QApplication([])
class Window(QWidget):
def __init__(self):
super().__init__()
self.setWindowTitle('QLCDNumber用法')
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