Re: Re: wx.Dialog not reported as destroyed after '.Destroy()' is called

Mike Driscoll <[email protected]> Thu, 6 Jun 2019 08:12:02 -0500
Newsgroups gmane.comp.python.wxpython.devel
Message-ID <CAO4gEAs5tDD4MSAS3RWAZ2h0-f6KXeqxdLsYQoM9xuHmh4d-PA@mail.gmail.com>
--00000000000055a155058aa776a6
Content-Type: text/plain; charset="UTF-8"

On Thu, Jun 6, 2019 at 7:19 AM Jasper Elzinga | Alexion Software <
[email protected]> wrote:

> Thanks! This works.
>
> However.. returning to the mainloop is not possible in our actual use
> case. We have a global dialog manager, and the code behind our button asks
> it for a dialog in a loop. The dialog manager has to know wether or not a
> dialog can be reused: if it's destroyed it can't be reused, but if it's for
> example hidden it can. This check currently fails. We can't allow the
> program to be accessable while the loop is running, thats why we use
> ShowModal and why wx.CallAfter is not possible (or at least i dont know how
> it would be possible using it).
>
> Any suggestions? Perhaps there is a way to simulate an idle event? This
> way we can remain in our loop.
>
> Ofcourse we can always do our own "destroyed" management with a
> 'self.destroyed' variable thats set to True by the 'Destroy' method in our
> dialog, but this feels wrong to me :)
>
> Thanks,
> Jasper
>


You can send your own idle events:
https://wxpython.org/Phoenix/docs/html/wx.IdleEvent.html

Just read the documentation carefully as it can increase system load.

Mike

-----------------
Mike Driscoll

Blog:   http://blog.pythonlibrary.org
Books: Python 101 <https://gum.co/py101>, Python 201: Intermediate Python
<https://gum.co/py201>, wxPython Recipes
<https://www.apress.com/us/book/9781484232361>, Python Interviews
<https://www.packtpub.com/web-development/python-interviews>

-- 
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/wxPython-dev/CAO4gEAs5tDD4MSAS3RWAZ2h0-f6KXeqxdLsYQoM9xuHmh4d-PA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--00000000000055a155058aa776a6
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><br clear=3D"all"><div><div dir=3D"ltr" c=
lass=3D"gmail_signature" data-smartmail=3D"gmail_signature"><div dir=3D"ltr=
"><div><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div dir=3D"ltr"><div><b=
r></div></div></div></div></div></div></div></div></div></div></div><br><di=
v class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Thu, Jun 6=
, 2019 at 7:19 AM Jasper Elzinga | Alexion Software &lt;<a href=3D"mailto:j=
[email protected]">[email protected]</a>&gt; wrote:<br></div><blockquote cla=
ss=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid =
rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">Thanks! This works.<br>=
<br>However.. returning to the mainloop is not possible in our actual use c=
ase. We have a global dialog manager, and the code behind our button asks i=
t for a dialog in a loop. The dialog manager has to know wether or not a di=
alog can be reused: if it&#39;s destroyed it can&#39;t be reused, but if it=
&#39;s for example hidden it can. This check currently fails. We can&#39;t =
allow the program to be accessable while the loop is running, thats why we =
use ShowModal and why wx.CallAfter is not possible (or at least i dont know=
 how it would be possible using it).<br><br>Any suggestions? Perhaps there =
is a way to simulate an idle event? This way we can remain in our loop.<br>=
<br>Ofcourse we can always do our own &quot;destroyed&quot; management with=
 a &#39;self.destroyed&#39; variable thats set to True by the &#39;Destroy&=
#39; method in our dialog, but this feels wrong to me :)<br><br>Thanks,<br>=
Jasper</div>=C2=A0=C2=A0</blockquote><div><br></div><div>You can send your =
own idle events:=C2=A0<a href=3D"https://wxpython.org/Phoenix/docs/html/wx.=
IdleEvent.html">https://wxpython.org/Phoenix/docs/html/wx.IdleEvent.html</a=
>=C2=A0</div><div><br></div><div>Just read the documentation carefully as i=
t can increase system load.</div><div><br></div><div>Mike</div><div><br></d=
iv><div><div>-----------------<br>Mike Driscoll<br><br>Blog:=C2=A0=C2=A0=C2=
=A0<a href=3D"http://blog.pythonlibrary.org/" target=3D"_blank">http://blog=
.pythonlibrary.org</a><br></div>Books:=C2=A0<a href=3D"https://gum.co/py101=
" target=3D"_blank">Python 101</a>,=C2=A0<a href=3D"https://gum.co/py201" t=
arget=3D"_blank">Python 201: Intermediate Python</a>,<a href=3D"https://www=
.apress.com/us/book/9781484232361" target=3D"_blank">=C2=A0wxPython Recipes=
</a>,=C2=A0<a href=3D"https://www.packtpub.com/web-development/python-inter=
views" target=3D"_blank">Python Interviews</a>=C2=A0<br><br class=3D"gmail-=
Apple-interchange-newline"></div></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;wxPython-dev&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">wxPyth=
[email protected]</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/d/msgid/wxPython-dev/CAO4gEAs5tDD4MSAS3RWAZ2h0-f6KXeqxdLsYQoM9xuHmh4d-PA=
%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.go=
ogle.com/d/msgid/wxPython-dev/CAO4gEAs5tDD4MSAS3RWAZ2h0-f6KXeqxdLsYQoM9xuHm=
h4d-PA%40mail.gmail.com</a>.<br />
For more options, visit <a href=3D"https://groups.google.com/d/optout">http=
s://groups.google.com/d/optout</a>.<br />

--00000000000055a155058aa776a6--