0

Can I ask how can I make each card bind switch to different or specific screen? Is it using if else function to do it?

    def load(self):
        with open('images.json') as f:
            image_data = f.read()
            images = json.loads(image_data)['PRD'].items()

        self.root.ids.prd_rv.data = [{'viewclass': 'Card', 'name': k, 'source': v, 'owner': self} for k,v in prd_images]

    def switch_screen(self, *args):
        if self.root.ids.prd_rv.data[0]:
            self.root.screen_manager.current = 'prdtd01'
  • i'd recommend adding using buttons and gridlayout, this will allow us to bind a function to the button individually with its text, and accordingly switch screen – Yash Kolekar Jan 11 '21 at 13:29
  • But what about bind its function with index? –  Jan 11 '21 at 15:07
  • I am not really familiar with recycleview, but if you can figure out a way to access it's children, you can simply, `child.bind(on_release = self.do_this)`, in a method of the screen in which the view is. Then in do_this, you will get an instance of the button that pressed it, using that instance, you can switch to the other screen, self.manager.current = instance.text – Yash Kolekar Jan 11 '21 at 15:58

0 Answers0