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

Python • Re: picamera2 prevent user from closing preview window

$
0
0

Code:

from tkinter import Tk, Buttonroot = Tk()Button(root, text="Exit", command=root.destroy).pack()root.protocol("WM_DELETE_WINDOW", lambda: print("Use of X is not allowed"))root.mainloop()
Source: https://stackoverflow.com/questions/454 ... ter-window
I want to set this callback only for the image preview window and not the root window, but the picamera2 library hides this.
Saw it too late. You have to address the window instead of root. AFIK Picamera uses on the desktop QtGL. This is a complete different framework. You could figure out how to address the new window which were created by Qt or you make your own preview window, which allows you full control.

Statistics: Posted by DeaD_EyE — Thu Aug 15, 2024 9:34 am



Viewing all articles
Browse latest Browse all 1282

Trending Articles