Search code examples
pythonpython-3.xkivykivy-language

Kivy - A row is being duplicated/mirrored and I can't see the cause


First post here with a simple question that will be obvious to your well trained eyes. I have been staring at a piece of code from your site for a couple of hours and encountered an issue that I cannot find an answer for anywhere!

How to Add row Dynamically

When you run this the row that is generated is split into two/mirrored, with 2 identical buttons and text inputs side by side. I only want one button and one text input. Please can someone tell me what part of the code is doing this and how? I'm dying to know!

Many thanks in advance,

Joe


Solution

  • I've worked it out, for anyone encounters the same problem.

    When we build the App:

    class test(App):

    def build(self):
        self.root = Builder.load_file('test.kv')
        return self.root
    

    The Builder.load_file loads the file in twice as it's already being called on self.root

    This is the cause though I doubt I'm describing it correctly.

    Just hash out the builder line and it performs normally.