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.
Where to store custom data for a UI view?
-
I am building a little share extension with a
view
UI. For this UI I need a few extra variables along side the view of the extension.What's the best place to store these variables?
- Global variables (either individually or as a class object with attributes)?
or
- Using a sub-classed
View
just to hold these variables in the UI?
-
@halloleooo you can add your own attributes to the standard ui.View without sub-classing it.
import ui v = ui.View() v.user_attribute = 'my data' v.present() print(dir(v)) print(v.user_attribute)
-
@cvp That's so super-cool! That's the perfect solution for me: Then I don't need global variables!
-
This post is deleted!