I use PDFWindow to open a pdf file. After that, I want to close the
file and then delete it. But even though PDFWindow is destroyed, the
pdf file is still open. I can not find an explicit method to close the
file, PDFWindow has only LoadFile.
Is there a possible solution? My application runs under Windows, so
when an file is open, it can not be deleted.
I use PDFWindow to open a pdf file. After that, I want to close the
file and then delete it. But even though PDFWindow is destroyed, the
pdf file is still open. I can not find an explicit method to close the
file, PDFWindow has only LoadFile.
Is there a possible solution? My application runs under Windows, so
when an file is open, it can not be deleted.
Best Regards
You can use LoadFile to open a different file, which closes the first
file. I usually keep a special, empty PDF file handy for this.
I use PDFWindow to open a pdf file. After that, I want to close the
file and then delete it. But even though PDFWindow is destroyed, the
pdf file is still open. I can not find an explicit method to close the
file, PDFWindow has only LoadFile.
Is there a possible solution?
Did you try loading another file? (Perhaps just a small simple one that
shows your logo or something.)
My application runs under Windows, so
when an file is open, it can not be deleted.
BTW, I can't duplicate this. I ran the demo, loaded a PDF, switched to
another sample in the demo, and then tried deleting the PDF file. It
deleted without any error.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
What I attempted to achieve is to generate a temporary PDF file from
business objects in my project, show it to the user for preview or
printing. When the user closes the view window, the temporary file
should be deleted.
Attached below is a small demonstration of this. Instead of generating
a PDF file, I just copy from an existing one. After the view dialog is
destroyed, os.remove returns:
BTW, I can't duplicate this. I ran the demo, loaded a PDF, switched to
another sample in the demo, and then tried deleting the PDF file. It
deleted without any error.
BTW, I can't duplicate this. I ran the demo, loaded a PDF, switched to
another sample in the demo, and then tried deleting the PDF file. It
deleted without any error.
What I attempted to achieve is to generate a temporary PDF file from
business objects in my project, show it to the user for preview or
printing. When the user closes the view window, the temporary file
should be deleted.
Attached below is a small demonstration of this. Instead of generating
a PDF file, I just copy from an existing one. After the view dialog is
destroyed, os.remove returns:
I think it's a timing thing. Watching the processes in Windows Task Manager, there is quite a delay before AcroRd32.exe terminates and releases the file. It also seems to depend on the version of Acrobat Reader (or possibly which Activex control in wx.lib.pdfwin is being used).
--
Regards,
I created a FileDialog then call ShowModal on this new dialog.
Then, I close my application (using the windows tray).
Just before exiting my application, I try to close each opened Frane (including the FileDialog) using Destroy() (Close(force = True) give the same result)
I created a FileDialog then call ShowModal on this new dialog.
Then, I close my application (using the windows tray).
Just before exiting my application, I try to close each opened Frane (including the FileDialog) using Destroy() (Close(force = True) give the same result)
But this FileDialog (or a DirDialog) stay opened.
so Is it possibled to close this Frame ?
The FileDialog and most of the other common dialogs are not true wx.Dialogs. The are just wrappers around a system API that shows the system dialog and returns some values. Because of this most of the wx.Window or wx.Dialog methods are simply ignored. The only way that I know of to close a wx.FileDialog is for the user to do it.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!