Используемый мной код:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from PyQt5.QtWidgets import QWidget
from PyQt5.QtWidgets import QPushButton
from PyQt5.QtWidgets import QCheckBox
from PyQt5.QtGui import QFont
class OpenChecker(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.setWindowTitle("OpenChecker")
self.setFixedSize(800, 600)
self.save = QPushButton("Save", self)
self.save.setFont(QFont("SansSerif", 10))
self.save.clicked.connect(self.save_task)
self.save.resize(self.save.sizeHint())
self.save.move(290,10)
self.load = QPushButton("Load", self)
self.load.setFont(QFont("SansSerif", 10))
self.load.clicked.connect(self.load_task)
self.load.resize(self.load.sizeHint())
self.load.move(380,10)
self.show()
def save_task(self):
print(1)
def load_task(self):
self.checkbox = QCheckBox("hello", self)
self.checkbox.move(0,0)
Проблема: checkbox не добавляется в окно программы.