Webmaster4o
Sep 07, 2015 - 03:33
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[0].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.anim doesn'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?