tworld
tworld copied to clipboard
Timer event arguments
When you send off a timer event with sched(), you might want to attach arguments to it, to be handed back when the event fires.
You can now do this, slightly awkwardly, using functools.partial
.
For example, if func
is a code property that takes one argument, then this code will schedule a timer event that calls func("foo")
:
sched(1, functools.partial(func, "foo"))
I'm leaving this issue open because I might come up with a better plan. Unfortunately the obvious:
sched(1, func, "foo")
...isn't compatible with the current sched() syntax. Might have to add sched_args() or something.