Accordion dynamic

22 views
Skip to first unread message

Konstantinos Spanos

unread,
Oct 21, 2017, 6:53:27 AM10/21/17
to kivy-...@googlegroups.com
Hello

I try to make a accordion,I get data from the base and I want to place them on the accordio dynamic,every element that comes from the bottom I put it under the other as one works one ListView.


when I use clear_widgets () it only shows me the new element that I get from the base
when I do not use it makes them dynamic but ιt shows me on a brown screen all
and it adds to me the last element since I call the function logically 
I do not know if I use the widget well
Thanks
an example I want to use a dynamic accordion


kv:

BoxLayout:
       orientation: 'vertical'
        id: all_orders
        size_hint_x: 0.9
        size_hint_y: None
        height: self.parent.height/1.4
        pos_hint: {'x': .05 , 'y': .1}

          Accordion:
              orientation: 'vertical'
              id:item_orders
              min_space: 30
python:

AccordionItem:
    id: acc_id
    title: '$acc_title'
    width : 640
    min_space: 20
    #BoxLayout:
    #    id:items
    Label:
        text: '$acc_content'
 ''')


     

        numrec = len(self.items_all)
        for product in self.items_all:
            
            acc_title = 'order'
            
            acc_content = ','.join([product['product_name'] for product in self.items_all])
            new_acc = self.tpitem.substitute(vars())
            
            acc = Builder.load_string(new_acc)

            self.item_orders.add_widget(acc)

ZenCODE

unread,
Oct 22, 2017, 4:52:16 PM10/22/17
to Kivy users support
Please try posting a runnable example. It's hard to guess seeing only small parts of the code...
Reply all
Reply to author
Forward
0 new messages