You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
500 B

2 years ago
  1. import wx # type: ignore
  2. class FileDrop(wx.FileDropTarget):
  3. def __init__(self, window, dropStrategy=None):
  4. wx.FileDropTarget.__init__(self)
  5. self.window = window
  6. self.dropHandler = dropStrategy or self._defaultStrategy
  7. def OnDropFiles(self, x, y, filenames):
  8. return self.dropHandler(x, y, filenames)
  9. def _defaultStrategy(self, x, y, filenames):
  10. for name in filenames:
  11. self.window.WriteText(name)
  12. return True