Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class LoadDialog(FloatLayout):
- load = ObjectProperty(None)
- cancel = ObjectProperty(None)
- <LoadDialog>:
- BoxLayout:
- size: root.size
- pos: root.pos
- orientation: "vertical"
- FileChooserListView:
- id: filechooser
- BoxLayout:
- size_hint_y: None
- height: 30
- Button:
- text: "Cancel"
- on_release: root.cancel()
- Button:
- text: "Load"
- on_release: root.load(filechooser.path, filechooser.selection)
- def show_load(self):
- content = LoadDialog(load=self.load, cancel=self.dismiss_popup)
- self._popup = Popup(title="Load file", content=content,
- size_hint=(0.9, 0.9))
- self._popup.open()
- def load(self, path, filename):
- wimg = os.path.join(path, filename[0])
- self.image_source = wimg
- self.dismiss_popup()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement