wxpython 4.0.3 wx.yield depreciated

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

wxpython 4.0.3 wx.yield depreciated

Gareth Finch
Hi All,

I'm hoping someone else has seen this.  I am running with python 3.7.0 and wxpython 4.0.3.  I am using wx.Yield() in a number of loops to allow the GUI to be refreshed and display an updated progress bar while the loop completes.  This works fine, however when upgrading to wxpython 4.0.3 I am now receiving a depreciation warning on wx.Yield().  The problem is this warning doesnt tell you what to do about it.  Previous depreciation warnings have prompted you to use a new method.  All this one gives is as follows;

DeprecationWarning: Yield() is deprecated

Does anyone know what you are supposed to replace this with moving forward or are we saying that there will be no replacement and you have to look at threading (maybe??) to get around this?  I really don't want to move to threading as I have tried this before (unsuccessfully) and get problems with trying to update the GUI from within a thread (not allowed).

Cheers in advance for the help.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: wxpython 4.0.3 wx.yield depreciated

Robin Dunn
On Wednesday, July 11, 2018 at 8:22:19 AM UTC-7, Gareth Finch wrote:
Hi All,

I'm hoping someone else has seen this.  I am running with python 3.7.0 and wxpython 4.0.3.  I am using wx.Yield() in a number of loops to allow the GUI to be refreshed and display an updated progress bar while the loop completes.  This works fine, however when upgrading to wxpython 4.0.3 I am now receiving a depreciation warning on wx.Yield().  The problem is this warning doesnt tell you what to do about it.  Previous depreciation warnings have prompted you to use a new method.  All this one gives is as follows;

DeprecationWarning: Yield() is deprecated

Does anyone know what you are supposed to replace this with moving forward or are we saying that there will be no replacement and you have to look at threading (maybe??) to get around this?  I really don't want to move to threading as I have tried this before (unsuccessfully) and get problems with trying to update the GUI from within a thread (not allowed).


https://docs.wxpython.org/wx.functions.html?highlight=yield#wx.Yield

Currently at least some items that are automatically marked as deprecated (because they are marked deprecated in wxWidgets) do not get a message to raise with the warning. But they usually have something mentioned in the docs.

In a nutshell, the recommended replacement is wx.GetApp().Yield(), although if you can organized your code to not need to Yield at all then that is always the best choice.

--
Robin


--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: wxpython 4.0.3 wx.yield depreciated

Gareth Finch
Thanks Robin.  I had checked the docs and they said to use wx.AppConsole.Yield which didnt make any sense to me. 

On 12 July 2018 at 03:15, Robin Dunn <[hidden email]> wrote:
On Wednesday, July 11, 2018 at 8:22:19 AM UTC-7, Gareth Finch wrote:
Hi All,

I'm hoping someone else has seen this.  I am running with python 3.7.0 and wxpython 4.0.3.  I am using wx.Yield() in a number of loops to allow the GUI to be refreshed and display an updated progress bar while the loop completes.  This works fine, however when upgrading to wxpython 4.0.3 I am now receiving a depreciation warning on wx.Yield().  The problem is this warning doesnt tell you what to do about it.  Previous depreciation warnings have prompted you to use a new method.  All this one gives is as follows;

DeprecationWarning: Yield() is deprecated

Does anyone know what you are supposed to replace this with moving forward or are we saying that there will be no replacement and you have to look at threading (maybe??) to get around this?  I really don't want to move to threading as I have tried this before (unsuccessfully) and get problems with trying to update the GUI from within a thread (not allowed).



Currently at least some items that are automatically marked as deprecated (because they are marked deprecated in wxWidgets) do not get a message to raise with the warning. But they usually have something mentioned in the docs.

In a nutshell, the recommended replacement is wx.GetApp().Yield(), although if you can organized your code to not need to Yield at all then that is always the best choice.

--
Robin


--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: wxpython 4.0.3 wx.yield depreciated

Robin Dunn
On Wednesday, July 11, 2018 at 2:58:03 PM UTC-7, Gareth Finch wrote:
Thanks Robin.  I had checked the docs and they said to use <a href="https://docs.wxpython.org/wx.AppConsole.html#wx.AppConsole.Yield" title="wx.AppConsole.Yield" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fdocs.wxpython.org%2Fwx.AppConsole.html%23wx.AppConsole.Yield\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGxMr9_bo3yFZmVtvGYqvHzOYwIDw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fdocs.wxpython.org%2Fwx.AppConsole.html%23wx.AppConsole.Yield\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGxMr9_bo3yFZmVtvGYqvHzOYwIDw&#39;;return true;">wx.AppConsole.Yield which didnt make any sense to me. 

wx.AppConsole is a base class of wx.App, so the text is indicating that you should call the Yield method of your app object. GetApp() is a helper that rturns the current app instance.

 --
Robin

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.