Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PySide6 Compatible Picamera2 Widgets #1198

Open
wants to merge 2 commits into
base: next
Choose a base branch
from

Conversation

LODean
Copy link

@LODean LODean commented Jan 24, 2025

Widgets "QGlPicamera2" and "QPicamera2" should be imported from from "picamera2.previews.qt_pyside6", rather than "picamera2.previews.qt", for use with PySide6.

Widgets can be used within a PySide6 application the same as they would with PyQt5.

Example of using QGLPicamera2 widget with PySide6 (modified from example in Picamera2 manual):

from PySide6.QtWidgets import QApplication
from picamera2.previews.qt_pyside6 import QGlPicamera2
from picamera2 import Picamera2

picam2 = Picamera2()
picam2.configure(picam2.create_preview_configuration())

app = QApplication()
qpicamera2 = QGlPicamera2(picam2, width=800, height=600, keep_ar=True)
qpicamera2.setWindowTitle("PySide6 Qt GL Picamera2 App")

picam2.start()
qpicamera2.show()
app.exec()

A QPicamera2 widget (no GPU integration) can be used identically by simply replacing "QGlPicamera2" with "QPicamera2".

…ra2.previews.q_picamera2.py, and picamera2.previews.q_gl_picamera2.py)

Copy of these files made to allow modifications for implementing as a PySide6 widget.

Rename files to appropriate respective PySide6 related names.

Signed-off-by: Levi Dean <leviodean@gmail.com>
…er than PyQt5

Replace imports in new qt_pyside6.py file with new q_pyside6_picamera2.py and q_pyside6_gl_picamera2.py files

Alter imports and method/object references in new q_pyside6_picamera2.py and q_pyside6_gl_picamera2.py files to use that of PySide6 rather than PyQt5

Signed-off-by: Levi Dean <leviodean@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant