(1) push 버튼 누르면 창꺼지면서 print출력
# -*- coding: utf-8 -*-
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtCore import QCoreApplication
class Window(QWidget):
def __init__(self):
super().__init__()
self.setGeometry(800,250,300,170)
self.setWindowTitle("QPushButton")
self.UI()
def UI(self):
self.text=QLabel("Don't Push the button", self)
enterPush=QPushButton("Push",self)
self.text.move(100, 50)
enterPush.move(120,85)
enterPush.clicked.connect(self.pushFunc)
self.show()
def pushFunc(self):
print("The window has been close.")
QCoreApplication.instance().quit()
def main():
App= QApplication(sys.argv)
window=Window()
sys.exit(App.exec_())
if __name__=='__main__':
main()
'전공 과목 이수1👨💻 > 파이썬' 카테고리의 다른 글
파이썬 - 함수 생성 예제 세개 (0) | 2020.12.03 |
---|---|
파이썬 - 객체 지향, 클래스 개념 (0) | 2020.11.28 |
파이썬 - pyQT 정렬 함수 | PyQt5.QtCore (0) | 2020.11.24 |
파이썬 pyQT예제 모음 (Button, Combobox, Checkbox...) (0) | 2020.11.14 |
파이썬 클래스 내용 (0) | 2020.10.15 |
파이썬 - Jupyter 시작할때, 수식어 작성하기 (0) | 2020.09.10 |