"""
@Time:2022/3/23 22:24
@Author:小柠檬
@File:check_box.py
"""
from PyQt5 import uic, QtCore
from PyQt5.QtWidgets import QApplication
class CheckBox:
def __init__(self):
self.ui = uic.loadUi("check_box.ui")
self.ui.checkBox.setChecked(True)
self.ui.checkBox.setChecked(False)
check_box_status = self.ui.checkBox.isChecked()
print(check_box_status)
self.ui.checkBox.clicked.connect(self.slot_check_box)
@staticmethod
def slot_check_box():
print('复选框被点击了')
def main():
QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)
app = QApplication([])
check_box = CheckBox()
check_box.ui.show()
app.exec_()
if __name__ == '__main__':
main()