Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5801

Camera board • Re: Picam2 preview becomes not fullscreen after changing x

$
0
0
Let me preface this by saying that I don't know anything about Qt.

Having said that, it certainly looks to me like Qt is detecting that your window (in the first case) is the size of the entire screen, and deciding to display it in a fullscreen manner, with no frame or title bar. In this case, it also decides that all input, including mouse clicks, belong to it.

As soon as your window isn't fullscreen, it uses different methods to figure out where to put the window, complete with title bar.

You could certainly write a very short Qt application that displays the images in a frameless window with no title bar. It might look a bit like this:

Code:

from PyQt5 import QtCorefrom PyQt5.QtWidgets import QApplicationfrom picamera2.previews.qt import QGlPicamera2from picamera2 import Picamera2picam2 = Picamera2()picam2.configure(picam2.create_preview_configuration())app = QApplication([])qpicamera2 = QGlPicamera2(picam2, width=700, height=600, keep_ar=False)qpicamera2.setWindowFlags(QtCore.Qt.FramelessWindowHint)qpicamera2.move(100, 0)qpicamera2.setWindowTitle("Picamera2")picam2.start()qpicamera2.show()app.exec()
You're then running a Qt event loop, so it's not clear to me how you create buttons with Tkinter. I think maybe this gets to the root of the problem, namely trying to get two competing GUI frameworks to play nicely together. I guess the built-in preview window (which is just a Qt window like the one above) could be changed to have a "frameless" mode, but overall, I'm nervous that trying to run these two frameworks like this is asking for problems.

Though perhaps not the most helpful answer, have you considered making a simple Qt app with some regular Qt buttons in it? There are some example here.

Statistics: Posted by therealdavidp — Fri Apr 19, 2024 9:06 am



Viewing all articles
Browse latest Browse all 5801

Trending Articles