On Python 3 you can use nonlocal, like so:
def main():
select = 0
@window.event
def on_key_press(symbol, mods):
nonlocal select
if symbol == key.DOWN:
select += 1
On Tue, Feb 25, 2014 at 10:03 AM, Henré Botha <[email protected]> wrote:
> Ah, thanks Petr! I didn't know assignments re-designate scope. I'll try your
> solutions tonight. I'm on Python 3, but I have to say your two proposed 2.x
> hacks don't strike me as valid. We'll see, I guess :P
>
> --
> You received this message because you are subscribed to the Google Groups
> "pyglet-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/pyglet-users.
> For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/groups/opt_out.