ui.animate for nested class functions is really awkward
Say I have a class, in which I have the function
animate(self)which does a bunch of actions and then animates something. It looks somehing like this:
def animate(self): def anim(self): self.subviews.frame=(10, 10, 100, 120) #Do stuff here ui.animate(anim(self), 1)
This doesn't work, because then it's not callable. Additionally, using
self.animdoesn't work, because anim isn't in the main namespace of the class. I actually have to call
ui.animate(lambda: anim(self), 1)
This seems awkward... Am I missing something?
Wait... Answered my own question.
selfas an argument, because it inherits this from the parent's namespace. I can use
def animate(self): def anim(): self.subviews.frame=(10, 10, 100, 120) #Do stuff here ui.animate(anim, 1)