Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
How to use custom attribures in pyui?
-
I have a view like this
class PathView (ui.View): def __init__(self, *arg, **kw): print(arg, kw) # notice here! self.flex = 'WH' self.path = None self.paths = [] self.action = None
And I made a pyui, use the custom view PathView, and put some custom attributes like this:
{"bc": "oooo" }
When I run the first script, it printed this:
() {}
Why?How should I use it?
-
Those are custom attributes not custom arguments. what happens is the view is created, with no input args:
v=PathView()
then, arguments are set:
v.width =.... v.bc="oooo"
and so on.
if you need to take action based on the custom attributes, you need to have those as @property's, to implement a setter.