Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mustafamuratcoskun
GitHub Repository: mustafamuratcoskun/Sifirdan-Ileri-Seviyeye-Python-Programlama
Path: blob/master/PyQt5 - Arayüz Geliştirme/Videolarda Kullanılan Kodlar/checkbox olusturma.py
765 views
1
import sys
2
3
from PyQt5.QtWidgets import QWidget,QApplication,QCheckBox,QLabel,QPushButton,QVBoxLayout
4
5
6
class Pencere(QWidget):
7
def __init__(self):
8
9
super().__init__()
10
11
self.init_ui()
12
13
def init_ui(self):
14
15
self.checkbox = QCheckBox("Python'ı seviyor musunuz ?")
16
self.yazi_alani = QLabel("")
17
self.buton = QPushButton("Bana Tıkla")
18
19
v_box = QVBoxLayout()
20
21
v_box.addWidget(self.checkbox)
22
v_box.addWidget(self.yazi_alani)
23
v_box.addWidget(self.buton)
24
25
self.setLayout(v_box)
26
27
self.setWindowTitle("Check Box")
28
29
self.buton.clicked.connect(lambda : self.click(self.checkbox.isChecked(),self.yazi_alani))
30
31
self.show()
32
33
def click(self,checkbox,yazi_alani):
34
if checkbox:
35
yazi_alani.setText("Python'ı seviyorsun çok güzel")
36
else:
37
yazi_alani.setText("Niye Sevmiyorsun ? ")
38
39
app = QApplication(sys.argv)
40
41
pencere = Pencere()
42
43
sys.exit(app.exec_())
44
45