FileDrop.py
from kivy.app import
from kivy.core.window import Window
class FileDropApp(App):
def build(self):
Window.bind(on_dropfile == self._on_file_drop)
return
#Event handling method you define
def _on_file_drop(self, window, file_path):
print(file_path)
return
if __name__ == '__main__':
FileDropApp().run()
Using this, I made a window creation ver as follows. I wonder if the window itself will have a file path acquisition function ...
MyApp.py
from kivy.app import App
from kivy.core.window import Window
from kivy.uix.widget import Widget
from kivy.graphics import Rectangle
class Field(Widget):
def __init__(self):
super(Field, self).__init__()
self.canvas.add(Rectangle(
source="background.jpg ", size = (1024,768)))
#Drop object? As a property
self._file = Window.bind(on_dropfile=self._on_file_drop)
#Processing method defined by yourself
def _on_file_drop(self, window, file_path):
print(file_path)
return
class MyApp(App):
def build(self):
return Field()
if __name__ == '__main__':
MyApp().run()
The goal is to drop, read the CSV file and stream the data to R ...
Recommended Posts