暂无描述

pushbutton2.py 575B

1234567891011121314151617181920212223
  1. import sys
  2. from PyQt5.QtWidgets import *
  3. class MyWindow(QMainWindow):
  4. def __init__(self):
  5. super().__init__()
  6. self.initUI()
  7. def initUI(self):
  8. self.setWindowTitle("SWH")
  9. button = QPushButton("눌러봐", self)
  10. button.move(50, 30)
  11. button.clicked.connect(self.pressed)
  12. def pressed(self):
  13. QMessageBox.about(self, "메세지 박스", "눌렀어요.")
  14. if __name__ == "__main__":
  15. app = QApplication(sys.argv)
  16. window = MyWindow()
  17. window.show()
  18. sys.exit(app.exec_())