Dynamically create new screens with labels, text inputs and buttons based on user input values on initial screen (Kivy)

Viewed 13

I am starting a GUI project using Kivy and I would like to know if there's a way to dynamically create new screens with widgets on them. These new screens and widgets will have attributes that were input by the user on the initial screen.

For example, on the inital screen I would ask the "family name", "number of members (say x)". Then I would like to have x number of screens (accessible one after the other, using a "Next" button), each with more data collection fields such as "Name", "Age", "Number of toys (say y but this would vary for each family member)" "Name of each toy" etc. Then after the data is collected for each family member, I would like to once again have x screens with y number of buttons.

I have been doing some research and have found some useful questions already answered but I would like to ask if instead of creating new screens, I update the labels for the purposes of data collection and store them in different variables. Is that the correct approach? Also I would like to ask what's the best way to arrange dynamically created widgets? I have been reading the Kivy layouts documentation but I am still a bit confused. I want to arrange them in a manner similar as shown below:

                 Family Name
           Member 1      Member 2   Mwmber 3.......x members
           
           Toy 1          Toy 1      Toy 1
           Toy 2          Toy 2      Toy 2
           Toy 3          Toy 3      Toy 3
           Toy 4          Toy 4      Toy 4
           .               .
           .               .
           .              z toys
           . y toys

I am also trying to figure out how would I bind the new buttons to functions. The number of buttons will depend on the user input and I need each button to print timestamp+buttonname (toy name in this case) to a .csv file. I was thinking that the functions and buttons could have consistent (organized) ids (generated using loops) and in that way it might be possible to bind them together.

0 Answers
Related