Browse Source

pyqt5 진행 중..

tobby48 6 years ago
parent
commit
dc42bcc14c

+ 11
- 0
src/kr/co/swh/lecture/python/pyqt5/window-event-slot.py View File

@@ -0,0 +1,11 @@
1
+import sys
2
+from PyQt5.QtWidgets import *
3
+
4
+def clicked():
5
+    print('클릭!')
6
+    
7
+app = QApplication(sys.argv)
8
+button = QPushButton('Hello World!')
9
+button.clicked.connect(clicked)
10
+button.show()
11
+app.exec_()

+ 7
- 0
src/kr/co/swh/lecture/python/pyqt5/window-helloworld.py View File

@@ -0,0 +1,7 @@
1
+import sys
2
+from PyQt5.QtWidgets import *
3
+
4
+app = QApplication(sys.argv)
5
+label = QLabel('Hello World!')
6
+label.show()
7
+app.exec_()

+ 7
- 0
src/kr/co/swh/lecture/python/pyqt5/window-helloworld2.py View File

@@ -0,0 +1,7 @@
1
+import sys
2
+from PyQt5.QtWidgets import *
3
+
4
+app = QApplication(sys.argv)
5
+button = QPushButton('Hello World!')
6
+button.show()
7
+app.exec_()

+ 14
- 0
src/kr/co/swh/lecture/python/pyqt5/window-main-window.py View File

@@ -0,0 +1,14 @@
1
+import sys
2
+from PyQt5.QtWidgets import *
3
+        
4
+app = QApplication(sys.argv)
5
+mywindow = QMainWindow()
6
+button = QPushButton("눌러봐", mywindow)
7
+button.move(50, 30)
8
+
9
+def click():
10
+    QMessageBox.about(button, "메세지 박스", "눌렀어요.")
11
+    
12
+button.clicked.connect(click)
13
+mywindow.show()
14
+app.exec_()

+ 20
- 0
src/kr/co/swh/lecture/python/pyqt5/window-main-window2.py View File

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