Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PyQt5.QtWidgets import QApplication, QWidget, QFormLayout, QCheckBox, QLineEdit
- class HideAndSeek(QWidget):
- def __init__(self):
- def is_clicked(ln):
- return lambda x: ln.setVisible(x)
- super().__init__()
- self.setWindowTitle('Прятки для виджетов')
- self.setGeometry(300, 300, 345, 85)
- form = QFormLayout(self)
- for i in range(4):
- check_box = QCheckBox(str(i+1))
- line_edit = QLineEdit(str(i+1))
- line_edit.setVisible(False)
- form.addRow(check_box, line_edit)
- check_box.clicked.connect(is_clicked(line_edit))
- app = QApplication([])
- window = HideAndSeek()
- window.show()
- app.exec_()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement