PyQt6 and QWindowCapture

Maurizio Berti maurizio.berti at gmail.com
Mon Feb 26 04:10:28 GMT 2024


Instead of relying on arbitrary delays, you may consider installing an
event filter on the target window and wait for QEvent.Type.Show, which
should be safe enough. Once that's received the first time, you can remove
the event filter and start querying the capturable windows.

Regards,
MaurizioB

Il giorno ven 23 feb 2024 alle ore 21:11 Jason Hallen <hallenj at gmail.com>
ha scritto:

> Thanks for the suggestion, Vincent. I was able to figure out the problem.
> My code was calling the QWindowCapture.capturableWindows() list before the
> main PyQt window was fully shown. That's why "TESTING TESTING" wasn't on
> the list. The solution was to call QWindowCapture.capturableWindows() at a
> later point (within a second even) once the window was shown. Then "TESTING
> TESTING" appears in the list and I can capture it.
>
> You're correct that "TESTING TESTING" is not an identifier, but the
> .description() attribute of the QCapturableWindow (which is basically the
> window title) is a convenient way of finding my window.
>
> Thanks,
> Jason
>
> On Fri, Feb 23, 2024 at 12:02 PM Vincent Vande Vyvre <
> vincent.vande.vyvre at telenet.be> wrote:
>
>> On 22/02/24 23:50, Jason Hallen wrote:
>> The window's title "Testing Testing" is not an identifier.
>> I suspect the widget you're searching for is the:
>> > 12 - anim.py — anim - <PyQt6.QtMultimedia.QCapturableWindow object at
>> > 0x1034f6ea0>
>>
>>
>> Vincent
>>
>>
>>

-- 
È difficile avere una convinzione precisa quando si parla delle ragioni del
cuore. - "Sostiene Pereira", Antonio Tabucchi
http://www.jidesk.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20240226/470f8423/attachment.htm>


More information about the PyQt mailing list