QCheckBox
from PyQt5.QtWidgets import *
import sys
class Pencere(QWidget):
def __init__(self):
super().__init__()
self.layout = QVBoxLayout(self)
self.checkbox1 = QCheckBox(self)
self.checkbox1.setText("Ev")
self.checkbox2 = QCheckBox(self)
self.checkbox2.setText("Araba")
self.buton = QPushButton(self)
self.buton.setText("Tamam")
self.layout.addWidget(self.checkbox1)
self.layout.addWidget(self.checkbox2)
self.layout.addWidget(self.buton)
self.buton.clicked.connect(self.hangiButon)
def hangiButon(self):
if self.checkbox1.isChecked():
print(self.checkbox1.text())
if self.checkbox2.isChecked():
print(self.checkbox2.text())
uygulama = QApplication(sys.argv)
pencere = Pencere()
pencere.show()
uygulama.exec_()Last updated