wxPython,
I have a
child window with lots of buttons, textctrls and listctrls.
Do I need to
call Destroy for each widget before closing the child window?
Is simply calling self.Destroy() once when closing the child window enough?
Thanks,
Bruce
wxPython,
I have a
child window with lots of buttons, textctrls and listctrls.
Do I need to
call Destroy for each widget before closing the child window?
Is simply calling self.Destroy() once when closing the child window enough?
Thanks,
Bruce
If you have set up the parenting correctly, this will all be handled
for you. Most of the time, the Destroy problems only relate to
top-level windows.
bruce g wrote:
I have a
child window with lots of buttons, textctrls and listctrls.
Do I need to
call Destroy for each widget before closing the child window?
Is simply
calling self.Destroy() once when closing the child window
enough?
-- Tim Roberts, Providenza & Boekelheide, Inc.
I forgot to mention that the child window may be opened and closed many times before the main window exits.
Is your answer still valid?
On Tuesday, December 24, 2013 3:22:19 PM UTC-5, Tim Roberts wrote:
bruce g wrote:
I have a
child window with lots of buttons, textctrls and listctrls.
Do I need to
call Destroy for each widget before closing the child window?
Is simply
calling self.Destroy() once when closing the child window
enough?
If you have set up the parenting correctly, this will all be handled
for you. Most of the time, the Destroy problems only relate to
top-level windows.-- Tim Roberts, ti...@probo.com Providenza & Boekelheide, Inc.
bruce g wrote:
I forgot to mention that the child window may be opened and closed
many times before the main window exits.
Is your answer still valid?
That doesn't make any difference. Note, however, that if you have a
dialog that gets re-used many times, it's better to create it once, then
use show and hide to manage its visibility, then destroy it once when
you are done. Otherwise, you waste a lot of time creating and
destroying the resources for your many controls.
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
Often with panels with a lot of widgets there could be attributesa that point to other Python objects that require explicit closing or deletion. wx.aui.AuiManager comes to mind, as well as file handles, network objects etc. I think along time ago timers where a limited resource that needed explicit destruction. Of the widget themselves you mention, if there are no other custom attributes added requiring closing then the parent will destroy wx widgets without issue. I wonder if any of those widgets you mentions if tied to an accelerator key would have issue.