
| Current Path : /proc/thread-self/root/home/ift/52_procpy/dataninja/workbench/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : //proc/thread-self/root/home/ift/52_procpy/dataninja/workbench/qcheckbox.py |
# -*- coding: utf-8 -*-
__author__ = 'djstava@gmail.com'
"""
ZetCode PyQt5 tutorial
In this example, a QCheckBox widget
is used to toggle the title of a window.
author: Jan Bodnar
website: zetcode.com
last edited: January 2015
"""
import sys
from PyQt5.QtWidgets import QWidget, QCheckBox,QLabel, QApplication
from PyQt5.QtCore import Qt
class Example(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.createCheckBox(self);
self.setGeometry(300, 300, 400, 400)
self.setWindowTitle('QCheckBox')
self.show()
def createCheckBox(self):
lable=QLabel(self)
lable.setText(u"Option 1----------")
cb = QCheckBox('', self)
cb.move(60, 20)
cb.toggle()
def changeTitle(self, state):
if state == Qt.Checked:
self.setWindowTitle('QCheckBox')
else:
self.setWindowTitle('')
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())