79489447

Date: 2025-03-06 13:09:18
Score: 1
Natty:
Report link

Ok, so, the answer I used looked like this:

class MyClassName(App):
    def __init__(self, **kwargs):
        super(MyClassName, self).__init__(**kwargs)
        Clock.schedule_once(lambda dt: self.place_canvas(), timeout=0.01)
    #Create card
    card1 = Factory.CardGL()

    #Placing card in scrolling layout
    sm.get_screen('sm3').ids.Dashboard_SM_1.get_screen('DB_MAIN').ids.DB_MAIN_BL_T_01.add_widget(card1)
    sm.get_screen('sm3').ids.Dashboard_SM_1.get_screen('DB_MAIN').ids['card_1'] = weakref.ref(card1)




    def place_canvas(self):
        self.core_item = sm.get_screen('sm3').ids.Dashboard_SM_1.get_screen('DB_MAIN')
        self.bound_item = self.core_item.ids.card_1
        self.size_out = StringProperty()
        self.pos_out = StringProperty()
        self.size_out = self.bound_item.size
        self.pos_out = self.bound_item.pos
        self.bound_item.canvas.add(RoundedRectangle(source = self.GS_IMG_LSRC, pos = self.pos_out, size = self.size_out))
        # Header
        cardtopgl = Factory.CardTopGL()
        self.core_item.ids.card_1.add_widget(cardtopgl)
        self.core_item.ids['cardtop_gl'] = weakref.ref(cardtopgl)
        cardtopbt = Factory.CardTopBT(text='[b]Grocery[/b]')
        self.core_item.ids.cardtop_gl.add_widget(cardtopbt)



I didn't need to change any of the .kv stuff, and I've eliminated some of the other things I put in the card for berevities sake, but this should give a picture of what solved my issue. Basically I just made python wait until the object was rendered and placed before putting anything in it. This probably isn't the most ideal solution, but it works for my needs atm.

Thanks to the people who commented, even though I didn't use your exact solution, it took me down the road to find what I needed.

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Blacklisted phrase (0.5): I need
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Brian Linden