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.
How to use ui.delay()
-
I can't find any example of how to use ui.delay(). I've tried what seems the obvious simple case below, but the function always runs immediately... without any delay. Can you provide an example please. Thank you, Tony.
import ui import console def funcSome (): console.hud_alert('funcSome') ui.delay(funcSome(), 3)
-
Remove the () so that you are passing the function instead of calling the function.
Change the last line to:
ui.delay(funcSome, 3)
. -
Brilliant, thanks. All is clear, Tony.
-
... and now you got me started... with a bit of research... I discovered you can do this if you need to pass arguments:
import ui import console from functools import partial def funcSome (a, b): console.hud_alert(a + b) ui.delay(partial(funcSome, 'a', 'b'), 3)