Guest User

Untitled

a guest
Nov 19th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. import sys
  2. from PyQt5.QtWidgets import QApplication, QWidget, QPushButton
  3. from PyQt5.QtGui import QIcon
  4. from PyQt5.QtCore import pyqtSlot
  5.  
  6. class App(QWidget):
  7.  
  8. def __init__(self):
  9. super(App, self).__init__()
  10. self.title = 'PyQt5 button - pythonspot.com'
  11. self.left = 10
  12. self.top = 10
  13. self.width = 320
  14. self.height = 200
  15. self.initUI()
  16.  
  17. def initUI(self):
  18. self.setWindowTitle(self.title)
  19. self.setGeometry(self.left, self.top, self.width, self.height)
  20.  
  21. button = QPushButton('PyQt5 button', self)
  22. button.setToolTip('This is an example button')
  23. button.move(100,70)
  24. button.clicked.connect(self.on_click)
  25.  
  26. self.show()
  27.  
  28. @pyqtSlot()
  29. def on_click(self):
  30. print('PyQt5 button click')
  31.  
  32. if __name__ == '__main__':
  33. app = QApplication(sys.argv)
  34. ex = App()
  35. sys.exit(app.exec_())
Add Comment
Please, Sign In to add comment