Here is my user story:
After clicking on a particular button, a modal dialog box appears, containing a single large icon representing a single file, and an OK button. The header of the dialog box reads: "Please drag and drop this file onto application APPX, then click OK". The dialog box disappears after clicking OK.
Here is what I tried on MacOS 10.9.5, Python 2.7.8, wx 3.0.1.1:
import wx, os
class MyForm(wx.Frame):
#----------------------------------------------------------------------
def __init__(self):
wx.Frame.__init__(self, None, wx.ID_ANY, "Demo")
panel = wx.Panel(self, wx.ID_ANY)
openFileDlgBtn = wx.Button(panel, label="Show FileDialog")
openFileDlgBtn.Bind(wx.EVT_BUTTON, self.onOpenFile)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(openFileDlgBtn, 0, wx.ALL|wx.CENTER, 5)
panel.SetSizer(sizer)
#----------------------------------------------------------------------
def onOpenFile(self, event):
dlg = wx.FileDialog(
self, message="Please drag and drop this file onto your favorite text editor, then click OK",
defaultDir=os.getcwd(),
defaultFile="*.txt",
wildcard="TXT files (*.txt)|*.txt",
style=wx.OPEN
)
if dlg.ShowModal() == wx.ID_OK:
pass
dlg.Destroy()
#----------------------------------------------------------------------
if __name__ == "__main__":
app = wx.App(False)
frame = MyForm()
frame.Show()
app.MainLoop()
Notes: I have no control on the external application; which will just open the file. The wxDialog does not completely fit my requirements, since it displays folder navigation elements as well as other (greyed out) files. But that's not the main issue.
The problem/question:
The wxDialog will not let me drag and drop any file on MacOS. It works well on Windows and Linux (see comments). How to make it work on MacOS? What else than a FileDialog could I try? Ideally I'd have a simple frame showing the file to be dragged. Thanks.
After clicking on a particular button, a modal dialog box appears, containing a single large icon representing a single file, and an OK button. The header of the dialog box reads: "Please drag and drop this file onto application APPX, then click OK". The dialog box disappears after clicking OK.