0

Firstly, I am new to kivy. I want to add the selection widget(like button, check box, toggle button into my program based on the data(as in list by reading from the csv file). In other words, that the number of adding new widget must change according to data from csv file.enter image description here

I would like to add these new widgets into the blue circle section(box layout). Kind Regards, John

1 Answer 1

1

Create a box layout with a method adding desired widgets. Example:

class BoxLayoutWithBlueCircle(BoxLayout):

    def add_buttons(self, how_many):
        self.clear_widgets()

        for i in range(how_many):
            button = Button(text='button_{}'.format(i))
            # add here more attributes, like size
            self.add_widget(button)

Each time you call the method, a set of buttons will be added to the instance of BoxLayoutWithBlueCircle. You can bind it to a button.

Sign up to request clarification or add additional context in comments.

7 Comments

Is it also possible to remove the created buttons inside that Boxlayout via program.
@MooreJohn90 Method clear_widgets does that. You can call it directly just like add_buttons.
Thanks a lot @jligeza
Sure i will @jiligeza
Hi jiligeza, I also want to create a new window(widget) for getting adding new info as in input form when the user click on "Add New Item" button. How do I link the button and new form widget.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.