1234567891011121314151617181920212223242526272829303132333435363738394041 |
- 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)
-
- self.lineEdit = QLineEdit("", self)
- self.lineEdit.move(20, 50)
- self.lineEdit.textChanged.connect(self.lineEditChanged)
-
- 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 lineEditChanged(self):
- self.label.setText(self.lineEdit.text())
-
- def button2Clicked(self):
- self.label.clear()
- self.lineEdit.clear()
-
- if __name__ == "__main__":
- app = QApplication(sys.argv)
- window = MyWindow()
- window.show()
- sys.exit(app.exec_())
|