I want to change the default path location (to the desktop) of the FileChooserIconView kivy module. My attempt:
class LoadDialog(FloatLayout):
load = ObjectProperty(None)
cancel = ObjectProperty(None)
def get_default_path(self):
self.path = os.path.expanduser("~/Desktop") ## Get desktop path.
<LoadDialog>:
BoxLayout:
size: root.size
pos: root.pos
orientation: "vertical"
FileChooserIconView:
id: filechooser
path: root.get_default_path() ## THE PROBLEM. Calling but not working.
I needed to add a return statment to the get_default_path function:
#main.py
class LoadDialog(FloatLayout):
load = ObjectProperty(None)
cancel = ObjectProperty(None)
def get_default_path(self):
self.path = os.path.expanduser("~/Desktop")
return self.path ## I added the return statement
#my.kv
<LoadDialog>:
BoxLayout:
size: root.size
pos: root.pos
orientation: "vertical"
FileChooserIconView:
id: filechooser
path: root.get_default_path() ## WORKING