|
@@ -0,0 +1,49 @@
|
|
1
|
+import sys
|
|
2
|
+from PyQt5.QtWidgets import *
|
|
3
|
+from PyQt5.QtCore import *
|
|
4
|
+from PyQt5.QtGui import *
|
|
5
|
+
|
|
6
|
+class MyWindow(QMainWindow):
|
|
7
|
+ def __init__(self):
|
|
8
|
+ super().__init__()
|
|
9
|
+ self.title = 'SWH Academy Window.'
|
|
10
|
+ self.left = 200
|
|
11
|
+ self.top = 200
|
|
12
|
+ self.width = 360
|
|
13
|
+ self.height = 150
|
|
14
|
+ self.initUI()
|
|
15
|
+
|
|
16
|
+ def initUI(self):
|
|
17
|
+ self.setWindowTitle(self.title)
|
|
18
|
+ self.setGeometry(self.left, self.top, self.width, self.height)
|
|
19
|
+
|
|
20
|
+ self.label = QLabel("", self)
|
|
21
|
+ self.label.move(90, 20)
|
|
22
|
+ self.label.resize(172, 60)
|
|
23
|
+ self.img = QPixmap("poster.png")
|
|
24
|
+ self.button1Clicked()
|
|
25
|
+ self.label.show()
|
|
26
|
+
|
|
27
|
+ button1 = QPushButton("클릭", self)
|
|
28
|
+ button1.move(20, 90)
|
|
29
|
+ button1.clicked.connect(self.button1Clicked)
|
|
30
|
+
|
|
31
|
+ button2 = QPushButton("지우기", self)
|
|
32
|
+ button2.move(130, 90)
|
|
33
|
+ button2.clicked.connect(self.button2Clicked)
|
|
34
|
+
|
|
35
|
+ button3 = QPushButton("종료", self)
|
|
36
|
+ button3.move(240, 90)
|
|
37
|
+ button3.clicked.connect(QCoreApplication.instance().quit)
|
|
38
|
+
|
|
39
|
+ def button1Clicked(self):
|
|
40
|
+ self.label.setPixmap(self.img)
|
|
41
|
+
|
|
42
|
+ def button2Clicked(self):
|
|
43
|
+ self.label.clear()
|
|
44
|
+
|
|
45
|
+if __name__ == "__main__":
|
|
46
|
+ app = QApplication(sys.argv)
|
|
47
|
+ mywindow = MyWindow()
|
|
48
|
+ mywindow.show()
|
|
49
|
+ app.exec_()
|