본문 바로가기

PyQt54

사용자 정의 Signal 객체지향 PyQt5 예 Event Signal 버튼의 클릭 행위 : 버튼 clicked Handler Slot 버튼 클릭시 수행할 작업을 지정한 method [주의] pyQtSignal 객체를 인스턴스 변수로 만드는 것이 아니라 클래스 변수로 만들어야 한다. import sys from PyQt5.QtWidgets import * from PyQt5.QtCore import pyqtSlot, QObject, pyqtSignal # 사용자 정의 시그널 사용을 위한 클래스 정의 class CustomSignal(QObject): signal = pyqtSignal(int, str) # 반드시 클래스 변수로 선언할 것 def run(self): tempstr = "emit으로 전달" for i in range.. 2022. 4. 30.
Qt5 예제 import sys from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QToolTip, QMainWindow, QAction, qApp from PyQt5.QtCore import QCoreApplication from PyQt5.QtGui import QIcon, QFont import time class MyApp(QMainWindow): def __init__(self): super().__init__() if 선택 == '1': self.initUI_창띄우기() elif 선택 == '2': self.initUI_아이콘삽입() elif 선택 == '3': self.initUI_창닫기() elif 선택 == '4': self.initUI.. 2022. 3. 21.
[PyQt5] Widgets PyQt5 Tutorial - 파이썬으로 만드는 나만의 GUI 프로그램 https://wikidocs.net/book/2165 초보자를 위한 Python GUI 프로그래밍 - PyQt5 https://study-code.gitbook.io/python-basic/ Real Python https://realpython.com/qt-designer-python/#getting-started-with-qt-designer 사용자 정의 시그널(Custom Signal)과 Emit 사용법 https://ybworld.tistory.com/110 QPushButton import sys from PyQt5.QtWidgets import * from PyQt5.QtCore import * class MyWindow.. 2022. 2. 23.
[PyQt] PyQt Designer Qt는 GUI 프로그램 개발에 널리 쓰이는 크로스 플랫폼 프레임워크, C++프로그래밍 언어 사용 Qt5 설치 디렉토리 : C:\Anaconda3\Lib\site-packages\PyQt5 Qt Designer 실행 파일 : C:\Anaconda3\Library\bin\designer.exe 1. GUI 프로그램 구동 방법 1) GUI 레이아웃 작성 2) 시그널-슬롯 연결 및 슬롯 처리 함수(메서드) 작성 3) 실행 및 이벤트 루프 # PyQt에서는 QApplication 객체에서 exec_ 메서드를 호출해 이벤트 루프를 생성 # 이벤트를 처리할 함수 또는 메서드를 구현 => 슬롯(slot) = 콜백 함수(callback function) import sys from PyQt5.QtWidgets impor.. 2022. 2. 21.