Where to store custom data for a UI view?
I am building a little share extension with a
viewUI. 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)?
- Using a sub-classed
Viewjust 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!last edited by garysmith21