]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/wxPIA_book/Chapter-18/drop_target.py
3 class MyFileDropTarget(wx
.FileDropTarget
):
4 def __init__(self
, window
):
5 wx
.FileDropTarget
.__init
__(self
)
8 def OnDropFiles(self
, x
, y
, filenames
):
9 self
.window
.AppendText("\n%d file(s) dropped at (%d,%d):\n" %
10 (len(filenames
), x
, y
))
11 for file in filenames
:
12 self
.window
.AppendText("\t%s\n" % file)
15 class MyFrame(wx
.Frame
):
17 wx
.Frame
.__init
__(self
, None, title
="Drop Target",
22 label
= wx
.StaticText(p
, -1, "Drop some files here:")
23 text
= wx
.TextCtrl(p
, -1, "",
24 style
=wx
.TE_MULTILINE|wx
.HSCROLL
)
26 # setup the layout with sizers
27 sizer
= wx
.BoxSizer(wx
.VERTICAL
)
28 sizer
.Add(label
, 0, wx
.ALL
, 5)
29 sizer
.Add(text
, 1, wx
.EXPAND|wx
.ALL
, 5)
32 # make the text control be a drop target
33 dt
= MyFileDropTarget(text
)
34 text
.SetDropTarget(dt
)
37 app
= wx
.PySimpleApp()