Hello all!
I'm developing an application where currently connected machines are
displayed as images and files dropped on the image are then sent to
the target machine. However I'm having problem with the filedropping.
I have looked through several different tutorials/examples and
modifying the Filedrop class isn't helping at all, when files are
dragged on to the app, "stop sign" is shown.
However, when compiled with py2exe to be run on machines which are not
in frequent use, file drop works, which makes me wonder, if this some
windows update/software issue. These machines have only few
application installed like office and acrobat, as they are to be used
in conferences... They are installed from the same windows image as my
developing machine.
I'm running wxpython 2.9.3 and python 2.7.2 on Windows 7 (64bit).
Reduced example app (based on http://zetcode.com/wxpython/draganddrop/):
import wx
class FileDrop(wx.FileDropTarget):
def __init__(self,window):
wx.FileDropTarget.__init__(self)
self.window = window
def OnDropFiles(self, x, y, filenames):
print "Dropped files:"
for name in filenames:
print name +","
print "\n"
class DropFile(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, size = (450, 400))
self.screens = wx.BoxSizer(wx.HORIZONTAL)
self.panel = wx.Panel(self,-1)
self.panel.SetBackgroundColour(wx.WHITE)
i = 0
while i<3:
tra =
wx.Image("generated_image.png",wx.BITMAP_TYPE_PNG).ConvertToBitmap()
img = wx.StaticBitmap(parent=self.panel, id=i, bitmap=tra)
dt = FileDrop(img)
img.SetDropTarget(dt)
self.screens.Add(img,0, wx.LEFT|wx.RIGHT, border=3)
i += 1
self.screens.Layout()
self.panel.SetSizer(self.screens)
self.Show(True)
app = wx.App()
DropFile(None, -1, 'Filedrop')
app.MainLoop()