Files
xml-editor/examples/basic_input/check_box/demo.py

32 lines
893 B
Python

# coding:utf-8
import sys
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QApplication, QWidget, QHBoxLayout, QSizePolicy
from qfluentwidgets import CheckBox
class Demo(QWidget):
def __init__(self):
super().__init__()
self.hBoxLayout = QHBoxLayout(self)
self.checkBox = CheckBox('This is a check box', self)
self.checkBox.setTristate(True)
self.hBoxLayout.addWidget(self.checkBox, 1, Qt.AlignCenter)
self.setStyleSheet('Demo{background:white}')
self.resize(400, 400)
if __name__ == '__main__':
# enable dpi scale
QApplication.setHighDpiScaleFactorRoundingPolicy(
Qt.HighDpiScaleFactorRoundingPolicy.PassThrough)
QApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps)
app = QApplication(sys.argv)
w = Demo()
w.show()
app.exec_()