Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- from PyQt5.QtWidgets import QApplication, QVBoxLayout, QHBoxLayout, QLabel, QWidget, QPushButton, QLineEdit
- class Example(QWidget):
- def __init__(self):
- super().__init__()
- self.setUI()
- def setUI(self):
- h1box = QHBoxLayout()
- line_edit = QLineEdit()
- button = QPushButton("Submit")
- button.clicked.connect(self.buttonClicked)
- h1box.addWidget(line_edit)
- h1box.addWidget(button)
- h2box = QHBoxLayout()
- label = QLabel("0")
- h2box.addWidget(label)
- vbox = QVBoxLayout()
- vbox.addLayout(h1box)
- vbox.addLayout(h2box)
- self.setLayout(vbox)
- self.show()
- def buttonClicked(self):
- # label needs to be filled with LineEdit value
- app = QApplication(sys.argv)
- ex = Example()
- sys.exit(app.exec_())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement