Iñigo Serna wrote:
> Hi again,
>
> "curses.wrapper" allows to pass arguments to the supplied function.
> <code>
> def wrapper(func, *args, **kwds):
> ...
> func(*args, **kwds)
> ...
> </code>
>
> Urwid doesn't accept args:
> <code>
> def run_wrapper(self, fn, alternate_buffer=True):
> try:
> self.start(alternate_buffer)
> return fn()
> finally:
> self.stop()
> </code>
> That "alternate_buffer=True" eliminates the posibility to add "*args"
Screen.start() and Screen.stop() are now official parts of the API. If
you need to pass arguments to your function I suggest calling those
methods yourself. I am planning to add at least one more parameter to
the start() method, and I don't like the idea of mixing user parameters
and Urwid parameters at the same level.
If you really want to be able to use the run_wrapper() method and pass
in parameters, I could add the user parameters like this:
def run_wrapper(self, fn, fn_args=[], fn_kwargs={},
alternate_buffer=True):
...
Ian
_______________________________________________
Urwid mailing list
[email protected]
http://lists.excess.org/mailman/listinfo/urwid