Ask Your Question

Is it impossible to populate a spinner in my .kv file using a list in my .py file?

asked 2022-08-22 11:00:00 +0000

lakamha gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2022-04-08 14:00:00 +0000

ladyg gravatar image

No, it is not impossible. In fact, it is a common practice to populate a spinner in a .kv file using a list in a .py file. Here's an example:

In your .py file, define a list:

fruits = ['apple', 'banana', 'orange']

In your .kv file, create a spinner and set its values to the list:

    values: root.fruits

Make sure to prefix the list name with "root." to access it from the .kv file.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer

Question Tools


Asked: 2022-08-22 11:00:00 +0000

Seen: 14 times

Last updated: Apr 08 '22