wx.TextCtrl use drag and drop folder to get file path

I currently have a working app using wx.TextCtrl, where I open a select
folder dialogue box. I would like to add drag and drop so I could just drag
and drop a folder to get the folder path, so I could have both options
available to the user. Here is a section of my current code:

self.pathindir = wx.TextCtrl(panel, -1, pos=(35, 380), size=(300, 25))
self.buttonin = wx.Button(panel, -1, "Open", pos=(350, 378))
self.buttonin.Bind(wx.EVT_BUTTON, self.openindir)

def openindir(self, event):
    dlg = wx.DirDialog(self, "Choose your input lookup directory:",
style=wx.DD_DEFAULT_STYLE | wx.DD_NEW_DIR_BUTTON)
    if dlg.ShowModal() == wx.ID_OK:
        global pathindir
        pathindir = dlg.GetPath()
        self.SetStatusText("Your selected input lookup directory is: %s" %
pathindir)
    self.pathindir.Clear()
    self.pathindir.WriteText(pathindir)
    dlg.Destroy()

···

--
View this message in context: http://wxpython-users.1045709.n5.nabble.com/wx-TextCtrl-use-drag-and-drop-folder-to-get-file-path-tp5718060.html
Sent from the wxPython-users mailing list archive at Nabble.com.

Anyone please?

···

--
View this message in context: http://wxpython-users.1045709.n5.nabble.com/wx-TextCtrl-use-drag-and-drop-folder-to-get-file-path-tp5718060p5718069.html
Sent from the wxPython-users mailing list archive at Nabble.com.

In the wxPython demo, there is a drag and drop section which seems to do exactly what you want. Get the code from there, and adapt it to your situation.

···

On Mon, Jul 15, 2013 at 2:37 PM, speedyrazor kevwells@hotmail.co.uk wrote:

Anyone please?

View this message in context: http://wxpython-users.1045709.n5.nabble.com/wx-TextCtrl-use-drag-and-drop-folder-to-get-file-path-tp5718060p5718069.html
Sent from the wxPython-users mailing list archive at Nabble.com.

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.


Best Regards,
Michael Moriarity