[wxPython-users] Accepting files for Drag and drop on OS-X
Christopher Barker
Chris.Barker at noaa.gov
Thu Mar 8 11:51:24 PST 2007
Hi Kevin,
> I'm surprised there isn't any info about this on the wiki page.
I'll try to add it today.
> Basically, your app won't start receiving AppleEvents until it's fully
> started, so you won't get a MacOpenFile notification. However, if you
> drag a file onto an app to start it, you will receive the filename of
> the dragged file in the app's command line arguments, so you need to
> parse sys.argv, pull out the filename, and load it that way.
I just figured that out myself, when I noticed that I had argv emulation
turned on.
However, it would be nice have one point of entry, so I tried turning
argv emulation off, and then did get a MacOpenFile event, but with:
"-psn_0_66322433"
instead of a file name. Curious.
So I guess parsing sys.argv is the way to go. I suppose that's fine, as
it will work for command line usage as well.
The next step is to figure out how to catch it when a file is dropped in
the app Frame, in addition to dropping on the icon in the Finder or Doc.
Thanks,
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
More information about the wxpython-users
mailing list