So, I’m trying to access a subview element located in a custom view made in a .pyui
I saw another post where they suggested to use...
a = sender.superview['view1']['subview']
And it worked, I used it for assigning an image to the imageview and changing the alpha of the whole custom view when a button is tapped:
def example(sender):
def animation1():
#Here I “call” the subview element in the custom view
d = sender.superview['view1']['image']
z = ui.Image.named('image01.PNG')
d.image = z
#Here I access only to the custom view
view1 = sender.superview['view1']
view1.alpha = 1
ui.animate(animation1, duration=2)
Later in the same script I want to acces a Label and a button in another custom view and then change the Text and title when the button is tapped. I used the same structure of the first example but it still doesn’t work:
def example(sender):
def animation1():
d = sender.superview['view2']['bFac']
d.title = 'Example Title'
bla bla, more text
ui.animate(animation1,duration=2)
When I run the program I get the error TypeError: 'NoneType' object is not subscriptable
I don’t know if I’m making understand my self Xd, I’m new in Pythonista, hopping someone can answer me.