GridLayout:
rows: 10
cols: 10
Button:
text: '1'
Button:
text: '2'
# ... fill in the buttons.
Button:
text: '100'
As described here (https://stackoverflow.com/questions/54858229/how-can-i-create-a-10x10-button-grid-in-kivy-language), I'd like to know how can I create this 10x10 grid in Kv Language?
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To post to this group, send email to kivy-...@googlegroups.com.
Visit this group at https://groups.google.com/group/kivy-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/5ec59ae5-5506-4304-a71b-4dc82e8dd79a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
There are some things you could do to make it a little less tedious, but it will still be tedious in KV, if you have something so repetitive.
Others may have better suggestions…
You could create a class of 10 buttons and instance it 10 times… if your interested I could type it up – but more importantly I think this is about the right tool for the job.
I use KV for more static elements that are in my GUI layout. I typically will used nested BoxLayouts and GridLayouts to position and customize their appearance. If I have a list of items, or something as repetitive as your 1000 buttons, I would code it in Python (as a class derived from a layout class, and use KV to position this repetitive section into the layout.
I would use KV to define a single button, select the fontsize, color, other attributes that might be unique the button.
I hope this is helpful.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/48236d42-1c20-4629-9fd7-f5693e0d0c9e%40googlegroups.com.