12345678910111213141516171819202122232425262728293031323334353637383940 |
- import sys
- from PyQt5.QtWidgets import *
- from PyQt5.QtCore import *
-
- class MyWindow(QMainWindow):
- def __init__(self):
- super().__init__()
- self.initUI()
-
- def initUI(self):
- self.setWindowTitle('SWH Academy Window.')
- self.setGeometry(200, 200, 360, 100)
-
- self.label = QLabel("", self)
- self.label.move(120, 20)
- self.label.resize(150, 30)
-
- button1 = QPushButton("클릭", self)
- button1.move(20, 50)
- button1.clicked.connect(self.button1Clicked)
-
- button2 = QPushButton("지우기", self)
- button2.move(130, 50)
- button2.clicked.connect(self.button2Clicked)
-
- button3 = QPushButton("종료", self)
- button3.move(240, 50)
- button3.clicked.connect(QCoreApplication.instance().quit)
-
- def button1Clicked(self):
- self.label.setText("버튼이 클릭되었습니다.")
-
- def button2Clicked(self):
- self.label.clear()
-
- if __name__ == "__main__":
- app = QApplication(sys.argv)
- window = MyWindow()
- window.show()
- sys.exit(app.exec_())
|