I keep seeing destructor calls in wx for ad hoc dialogs and wonder if
this is required, and if so, why would normal gc flow not be good?
def GetDir(self,Cap tion,DefaultDir ):
dlg = wx.DirDialog(No ne,Caption,styl e = 1,defaultPath =
DefaultDir,pos = (10,10))
res = dlg.ShowModal()
pck = dialog.GetPath( )
dlg.Destroy()
if res == wx.ID_OK:
return pck
else:
return ''
I'd like to write it as:
def GetDir(self,Cap tion,DefaultDir ):
dlg = wx.DirDialog(No ne,Caption,styl e = 1,defaultPath =
DefaultDir,pos = (10,10))
if dlg.ShowModal() == wx.ID_OK:
return dialog.GetPath( )
else:
return '' # probably implied; del 2 more lines?
....and gc takes care of things once scope is exited? Or is wx more
tricksome than that?
this is required, and if so, why would normal gc flow not be good?
def GetDir(self,Cap tion,DefaultDir ):
dlg = wx.DirDialog(No ne,Caption,styl e = 1,defaultPath =
DefaultDir,pos = (10,10))
res = dlg.ShowModal()
pck = dialog.GetPath( )
dlg.Destroy()
if res == wx.ID_OK:
return pck
else:
return ''
I'd like to write it as:
def GetDir(self,Cap tion,DefaultDir ):
dlg = wx.DirDialog(No ne,Caption,styl e = 1,defaultPath =
DefaultDir,pos = (10,10))
if dlg.ShowModal() == wx.ID_OK:
return dialog.GetPath( )
else:
return '' # probably implied; del 2 more lines?
....and gc takes care of things once scope is exited? Or is wx more
tricksome than that?
Comment