Skip to content
Discussion options

You must be logged in to vote

In this case, it's not your fault - this is an area of Toga's API that could definitely be improved.

The issue is that the value of value needs to be a Row object - the internal representation of each item of content in the data. The complication is that it's not easy to get a Row object in the constructor.

The best workaround right now is to construct the Selection in two parts. You can do this in one of two ways.

Firstly, you can construct the selection as you have here, then set the value afterward. By setting the data, that will construct the data source, and you can then find the row for the item you want:

self.language_dropdown = toga.Selection(items=self.languages, accessor="name")…

Replies: 4 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@sholt6
Comment options

Answer selected by sholt6
Comment options

You must be logged in to vote
1 reply
@freakboy3742
Comment options

Comment options

You must be logged in to vote
1 reply
@freakboy3742
Comment options

Comment options

You must be logged in to vote
1 reply
@freakboy3742
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants