본문 바로가기
728x90
반응형
SMALL

Python Library/PyQt9

[PyQt] Error: Application failed to start because no Qt platform plugin could be initialized Error: Application failed to start because no Qt platform plugin could be initialized 시스템 파일 손상 확인 명령 프롬프트를 마우스 오른쪽 버튼으로 클릭하고 관리자 권한으로 실행을 선택한다. 여기서, sfc /scannow를 입력 하고 Enter 키를 누르고 다음을 시행한다. DISM /Online /Cleanup-Image /CheckHealth DISM /Online /Cleanup-Image /ScanHealth DISM /Online /Cleanup-Image /RestoreHealth https://ugetfix.com/ask/how-to-fix-application-failed-to-start-because-no-qt-plat.. 2022. 5. 23.
[PyQt] 툴바 툴바 메뉴가 어플리케이션에서 사용되는 모든 명령의 모음이라면, 툴바 (toolbar)는 자주 사용하는 명령들을 더 편리하게 사용할 수 있도록 해준다. import sys from PyQt5.QtWidgets import QApplication, QMainWindow, QAction, qApp from PyQt5.QtGui import QIcon class MyApp(QMainWindow): def __init__(self): super().__init__() self.initUI() def initUI(self): exitAction = QAction(QIcon('exit.png'), 'Exit', self) exitAction.setShortcut('Ctrl+Q') exitAction.setStatus.. 2022. 5. 20.
[PyQt] 메뉴바 메뉴바 GUI 어플리케이션에서 메뉴바 (menu bar)는 흔하게 사용된다. import sys from PyQt5.QtWidgets import QApplication, QMainWindow, QAction, qApp from PyQt5.QtGui import QIcon class MyApp(QMainWindow): def __init__(self): super().__init__() self.initUI() def initUI(self): exitAction = QAction(QIcon('exit.png'), 'Exit', self) exitAction.setShortcut('Ctrl+Q') exitAction.setStatusTip('Exit application') exitAction.trigge.. 2022. 5. 20.
[PyQt] 상태바 상태바 메인창 (Main window)은 메뉴바, 툴바, 상태바를 갖는 전형적인 어플리케이션이다. 메인창은 QMenuBar, QToolBar, QDockWidget, QStatusBar를 위한 고유의 레이아웃을 갖고 있다. 또한, 가운데 영역에 중심 위젯 (Central widget)을 위한 영역을 갖고 있다. 여기에는 어떠한 위젯도 들어올 수 있다. QMainWindow 클래스를 이용해서 메인 어플리케이션 창을 만들 수 있다. import sys from PyQt5.QtWidgets import QApplication, QMainWindow class MyApp(QMainWindow): def __init__(self): super().__init__() self.initUI() def initUI(s.. 2022. 5. 20.
[PyQt] 툴팁 툴팁 툴팁 (tooltip)은 어떤 위젯의 기능을 설명하는 등의 역할을 하는 말풍선 형태의 도움말이다. 위젯에 있는 모든 구성 요소에 대해서 툴팁이 나타나도록 할 수 있다. import sys from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QToolTip from PyQt5.QtGui import QFont class MyApp(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): QToolTip.setFont(QFont('SansSerif', 10)) # 툴팁에 사용될 폰트 설정, 10px 크기의 'SansSerif' 폰트 self.setTool.. 2022. 5. 20.
[PyQt] 창 닫기 버튼 창 닫기 버튼 import sys from PyQt5.QtWidgets import QApplication, QWidget, QPushButton from PyQt5.QtCore import QCoreApplication class MyApp(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): btn = QPushButton('Quit', self) btn.move(50, 50) btn.resize(btn.sizeHint()) btn.clicked.connect(QCoreApplication.instance().quit) self.setWindowTitle('Quit Button') self.setGeometry.. 2022. 5. 20.
[PyQt] 아이콘 삽입 아이콘 삽입 import sys from PyQt5.QtWidgets import QApplication, QWidget from PyQt5.QtGui import QIcon class MyApp(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): self.setWindowTitle('Icon') self.setWindowIcon(QIcon('siri.png')) self.setGeometry(300, 300, 300, 200) self.show() if __name__ == '__main__': app = QApplication(sys.argv) ex = MyApp() sys.exit(app.exec_()) 코.. 2022. 5. 20.
[PyQt] 창 띄우기 창 띄우기 창의 오른쪽 위 (Windows) 또는 왼쪽 위 (macOS)에 기본적으로 제공되는 버튼들로 창의 크기를 최대화, 최소화하거나 종료할 수 있다. 또한, 마우스를 가지고 창을 이동하거나 창의 크기를 조절할 수 있다. import sys from PyQt5.QtWidgets import QApplication, QWidget class MyApp(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): self.setWindowTitle('My First Application') self.move(300, 300) self.resize(400, 200) self.show() if __name__ == '__ma.. 2022. 5. 20.
PyQt PyQt PyQt는 Qt 어플리케이션 프레임워크에 대한 파이썬 버전이다. Qt는 플랫폼에 관계없이 다양한 기능을 포함하는 C++ 라이브러리이자 개발툴이다. PyQt는 이러한 1000여 개의 클래스들을 포함하는 파이썬 모듈의 모음이다. PyQt는 윈도우, 리눅스, macOS, 안드로이드, iOS를 지원한다. PyQt의 홈페이지(https://www.riverbankcomputing.com/software/pyqt/intro)에서 최신의 그리고 안정적인 버전의 PyQt와 최신 버전의 문서를 얻을 수 있다. PyQt 개발자는 GPL과 상업용 라이센스 중 하나를 선택할 수 있다. (PyQt 라이센스 관련 : https://www.riverbankcomputing.com/commercial/license-faq).. 2022. 5. 20.
728x90
반응형
LIST