PyQt6는 21년 2월 6일에 6.0.0.1 Version이 배포 되었습니다.

기본적인 hello world를 출력해보도록 하겠습니다.

<PyQt5>

import sys
from PyQt5.QtWidgets import QApplication, QWidget, QLabel
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import pyqtSlot

def helloworld():
   app = QApplication(sys.argv)
   widget = QWidget()

   textLabel = QLabel(widget)
   textLabel.setText("Hello World!")
   textLabel.move(150, 200)

   widget.setGeometry(50, 50, 400, 400)
   widget.setWindowTitle("PyQt5 Example")
   widget.show()
   sys.exit(app.exec_())

프로그램무한반복 = QApplication(sys.argv)
실행인스턴스 = helloworld()
프로그램무한반복.exec_()

<PyQt6>

import sys
from PyQt6.QtWidgets import QApplication, QWidget, QLabel
from PyQt6.QtGui import QIcon
from PyQt6.QtCore import pyqtSlot

def helloworld():
   app = QApplication(sys.argv)
   widget = QWidget()

   textLabel = QLabel(widget)
   textLabel.setText("Hello World!")
   textLabel.move(150, 200)

   widget.setGeometry(50, 50, 400, 400)
   widget.setWindowTitle("PyQt5 Example")
   widget.show()
   sys.exit(app.exec())

프로그램무한반복 = QApplication(sys.argv)
실행인스턴스 = helloworld()
프로그램무한반복.exec()

위 두 코드의 차이점은 아래와 같습니다.

  1. exec_()가 exec()가 되었습니다.
  2. PyQt5가 PyQt6가 되었습니다.

공식문서에는 어떤 내용이 담겨있는지 한 번 살펴보도록 하겠습니다.

Differences Between PyQt6 and PyQt5 - PyQt v6.1 Reference Guide

아래 영문 스크립트를 가져왔습니다.

In this section we give an overview of the differences between PyQt6 and PyQt5. This is not an exhaustive list and does not go into the detail of the differences between the Qt v6 and Qt v5 APIs.