Other people have answered this successfully, but I wanted to point out that your dlg.Destroy() won't be called if the user cancels the dialog, so your app will hang at exit. Execute it at the same level as "if...".
Phil
···
At 03:18 AM 6/3/2008, Andrea wrote:
Hi Leticia,
On Tue, Jun 3, 2008 at 11:06 AM, leticia Fernandez wrote:
> I have a normal file dialog:
>
> dlg = wx.FileDialog(self, message="Open...", defaultDir=os.getcwd(),
> defaultFile="", style=wx.OPEN)
>
> if dlg.ShowModal() == wx.ID_OK:
>
> filename = dlg.GetPath()
> wx.BeginBusyCursor()
> wx.EndBusyCursor()
>
> dlg.Destroy()
>
> # code to read the file
>