[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: PyQt6 and QWindowCapture
From:       Maurizio Berti <maurizio.berti () gmail ! com>
Date:       2024-02-26 4:10:28
Message-ID: CAPn+-XT_ViEPWjgFp+m0eXfgTd7wy7cyEyUXQCzuMAiTJN4wfQ () mail ! gmail ! com
[Download RAW message or body]

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@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@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

[Attachment #3 (text/html)]

<div dir="ltr"><div>Instead of relying on arbitrary delays, you may consider \
installing an event filter on the target window and wait for <span \
style="font-family:monospace">QEvent.Type.Show</span>, which should be safe enough. \
Once that&#39;s received the first time, you can remove the event filter and start \
querying the capturable \
windows.<br><br></div><div>Regards,</div><div>MaurizioB<br></div></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno ven 23 feb 2024 alle \
ore 21:11 Jason Hallen &lt;<a \
href="mailto:hallenj@gmail.com">hallenj@gmail.com</a>&gt; ha \
scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div \
dir="ltr"><div>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&#39;s why &quot;TESTING TESTING&quot; \
wasn&#39;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 &quot;TESTING \
TESTING&quot; appears in the list and I can capture \
it.</div><div><br></div><div>You&#39;re correct that &quot;TESTING TESTING&quot; 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.  \
</div><div><br></div><div>Thanks,</div><div>Jason<br></div><div></div></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 23, 2024 at \
12:02 PM Vincent Vande Vyvre &lt;<a href="mailto:vincent.vande.vyvre@telenet.be" \
target="_blank">vincent.vande.vyvre@telenet.be</a>&gt; wrote:<br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex">On 22/02/24 23:50, Jason Hallen wrote:<br> The \
window&#39;s title &quot;Testing Testing&quot; is not an identifier.<br> I suspect \
the widget you&#39;re searching for is the:<br> &gt; 12 - anim.py — anim - \
&lt;PyQt6.QtMultimedia.QCapturableWindow object at <br> &gt; 0x1034f6ea0&gt;<br>
<br>
<br>
Vincent<br>
<br>
<br>
</blockquote></div>
</blockquote></div><br clear="all"><br><span class="gmail_signature_prefix">-- \
</span><br><div dir="ltr" class="gmail_signature">È difficile avere una convinzione \
precisa quando si parla delle ragioni del cuore. - &quot;Sostiene Pereira&quot;, \
Antonio Tabucchi<br><a href="http://www.jidesk.net" \
target="_blank">http://www.jidesk.net</a></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic