I'm trying to run the code posted in the link below to handle drag-drop of files in a Kivy application. Kivy: drag n drop, get file path
from kivy.app import App
from kivy.core.window import Window
class WindowFileDropExampleApp(App):
def build(self):
Window.bind(on_dropfile=self._on_file_drop)
return
def _on_file_drop(self, window, file_path):
print(file_path)
return
if __name__ == '__main__':
WindowFileDropExampleApp().run()
It doesn't seem to be triggering the '_on_file_drop' event function when I drag a file into the application window. Any help getting this working would be great. My entire console output is the following:
$ python main.py
[INFO ] [Logger ] Record log in C:\Users\\.kivy\logs\kivy_17-02-10_163.txt
[INFO ] [Kivy ] v1.9.1
[INFO ] [Python ] v3.5.2 |Anaconda 4.2.0 (64-bit)| (default, Jul 5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)]
[INFO ] [Factory ] 179 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_gif, img_sdl2, img_pil (img_ffpyplayer ignored)
[INFO ] [OSC ] using <thread> for socket
[INFO ] [Window ] Provider: sdl2
[INFO ] [GL ] GLEW initialization succeeded
[INFO ] [GL ] OpenGL version <b'4.4.0 - Build 20.19.15.4463'>
[INFO ] [GL ] OpenGL vendor <b'Intel'>
[INFO ] [GL ] OpenGL renderer <b'Intel(R) Iris(TM) Graphics 540'>
[INFO ] [GL ] OpenGL parsed version: 4, 4
[INFO ] [GL ] Shading version <b'4.40 - Build 20.19.15.4463'>
[INFO ] [GL ] Texture max size <16384>
[INFO ] [GL ] Texture max units <32>
[INFO ] [Shader ] fragment shader: <b"WARNING: 0:7: '' : #version directive missing">
[INFO ] [Shader ] vertex shader: <b"WARNING: 0:7: '' : #version directive missing">
[INFO ] [Window ] auto add sdl2 input provider
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
[INFO ] [Base ] Start application main loop
[INFO ] [Base ] Leaving application in progress...