Constructing a slint struct
in Python requires kwargs
#9258
Unanswered
mitchgrout
asked this question in
General
Replies: 1 comment
-
Thanks for the suggestion. Yeah, I think that makes sense. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I may have missed this in the docs, but it appears that if you want to construct a
struct
exposed by slint in Python, you must use kwargs syntax. I was scratching my head over this for the last hour or so:I had a
pure callback validate(str: string) -> Result
in a component, and noticed that everything worked fine if I implemented the callback in slint. However, in my Python code I had:After a bunch of
debug()
prints in slint, I noticed that it was always observing the result to befalse
. Assuming this was a bug, I wrote up a quick MVP in which I ended up usingResult(ok=True)
for clarity and... problem fixed.I haven't really found much in the way of docs for the Python API, so I assume this is probably still a WIP. Is this behaviour intentional? If so, would it make sense to just raise an exception if we attempt to construct via positional arguments?
Beta Was this translation helpful? Give feedback.
All reactions