r/kivy

▲ 1 r/kivy

Text repeats itself in this scroll view and I didn't design it to do that

I am making a simple inventory app with some help with ai .

It was going well, did multi screen and made the first feature to fill up a form and save it to sqlite database.

Now I hit a wall with this part. I wanted to load the data from the database and ai suggested recycle view, but when the data is loaded, the text repeats itself in the same row, so I changed it to scroll view the result is the same.

https://preview.redd.it/ly4ay3dhhyjh1.png?width=988&format=png&auto=webp&s=90266d9fcad73e4c67683db29eec5ea9f5005719

here's my python code snippet for the part showing the database

class TerceraRow(BoxLayout):
    id_item=StringProperty()
    art= StringProperty()
    prop=StringProperty()
    serial=StringProperty()
    cust=StringProperty()
    cost=StringProperty()
    date=StringProperty()
    time_stamp=StringProperty()


class Tercera(Screen):
    def on_enter(self):
        self.load_data()


    def load_data(self):
        self.ids.inventory_list.clear_widgets()
        dbf=getData()
        for row in dbf:
            print(row)
            card=TerceraRow (
                art=str(row[1]),
                prop=str(row[2]),
                serial=str(row[3]),
                cust=str(row[4]),
                cost=str(row[5]),
                date=str(row[6]),
                time_stamp=str(row[7]),
            )
            self.ids.inventory_list.add_widget(card)

and here's the kv part

<TerceraRow>:
    padding: dp(12)
    spacing: dp(5)
    size_hint_y: None
    height: dp(150)


    canvas.before:
        Color:
            rgba: 0.95, 0.5, 0.5, 1


        RoundedRectangle:
            pos: self.pos
            size: self.size
            radius: [dp(10)]


    Label:
        text: root.art
        halign: "left"
        text_size: self.width, None


    Label:
        text: root.prop
        halign: "left"
        text_size: self.width, None


    Label:
        text: root.serial
        halign: "left"
        text_size: self.width, None


    Label:
        text: root.cust
        halign: "left"
        text_size: self.width, None


    Label:
        text: root.cost
        halign: "left"
        text_size: self.width, None


    Label:
        text: root.date
        halign: "left"
        text_size: self.width, None




<Tercera>:
    name: "tercera"  
    ScrollView:   
        BoxLayout:
            orientation: 'vertical'
            id:inventory_list
            size_hint_y:None
            height:self.minimum_height
            spacing:dp(10)
            padding:dp(10)

I don't have duplicates to in my database

reddit.com
u/LeonAguilez — 4 days ago