Advertisement
WupEly

Untitled

Sep 24th, 2022
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. from PyQt5.QtWidgets import QApplication, QWidget, QFormLayout, QCheckBox, QLineEdit
  2.  
  3.  
  4. class HideAndSeek(QWidget):
  5. def __init__(self):
  6. def is_clicked(ln):
  7. return lambda x: ln.setVisible(x)
  8.  
  9. super().__init__()
  10. self.setWindowTitle('Прятки для виджетов')
  11. self.setGeometry(300, 300, 345, 85)
  12. form = QFormLayout(self)
  13.  
  14. for i in range(4):
  15. check_box = QCheckBox(str(i+1))
  16. line_edit = QLineEdit(str(i+1))
  17. line_edit.setVisible(False)
  18. form.addRow(check_box, line_edit)
  19. check_box.clicked.connect(is_clicked(line_edit))
  20.  
  21.  
  22. app = QApplication([])
  23. window = HideAndSeek()
  24. window.show()
  25. app.exec_()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement