import sys from PyQt5.QtWidgets import * class MyWindow(QMainWindow): def __init__(self): super().__init__() self.initUI() def initUI(self): self.setWindowTitle("SWH") button = QPushButton("눌러봐", self) button.move(50, 30) button.clicked.connect(self.click) def click(self): QMessageBox.about(self, "메세지 박스", "눌렀어요.") if __name__ == "__main__": app = QApplication(sys.argv) window = MyWindow() window.show() app.exec_()