Advertisement
Guest User

Untitled

a guest
Dec 10th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. import sys
  2. from PyQt5.QtWidgets import QApplication, QVBoxLayout, QHBoxLayout, QLabel, QWidget, QPushButton, QLineEdit
  3.  
  4. class Example(QWidget):
  5.  
  6. def __init__(self):
  7. super().__init__()
  8. self.setUI()
  9.  
  10. def setUI(self):
  11. h1box = QHBoxLayout()
  12.  
  13. line_edit = QLineEdit()
  14. button = QPushButton("Submit")
  15. button.clicked.connect(self.buttonClicked)
  16.  
  17. h1box.addWidget(line_edit)
  18. h1box.addWidget(button)
  19.  
  20. h2box = QHBoxLayout()
  21. label = QLabel("0")
  22. h2box.addWidget(label)
  23.  
  24. vbox = QVBoxLayout()
  25.  
  26. vbox.addLayout(h1box)
  27. vbox.addLayout(h2box)
  28. self.setLayout(vbox)
  29. self.show()
  30.  
  31. def buttonClicked(self):
  32. # label needs to be filled with LineEdit value
  33.  
  34. app = QApplication(sys.argv)
  35. ex = Example()
  36.  
  37. sys.exit(app.exec_())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement