#/usr/bin/env python3 # -*- coding: utf-8 -*- from kivy.app import App from kivy.uix.boxlayout import BoxLayout from kivy.uix.image import Image from kivy.uix.button import Button from kivy.uix.filechooser import FileChooserIconView class ImageChooser(BoxLayout): def __init__(self, **kwargs): super().__init__(**kwargs) self.orientation = 'vertical' self.file_chooser = FileChooserIconView() self.add_widget(self.file_chooser) self.open_button = Button(text='Open Image') self.open_button.bind(on_press=self.open_image) self.add_widget(self.open_button) def open_image(self, instance): if self.file_chooser.selection: # Show Image self.image = Image() self.add_widget(self.image) # Load Image image_path = self.file_chooser.selection[0] self.image.source = image_path # Hide other Elements self.remove_widget(self.file_chooser) self.remove_widget(self.open_button) class DeutschlandTicket(App): def build(self): return ImageChooser() if __name__ == '__main__': app = DeutschlandTicket() app.run()