You are pushing a handler on every loop.
Once is enough.

win.push_handlers(keyboard)
while not win.has_exit:
    win.dispatch_events()
    win.flip()

----- Original Message ----- 
From: "yoshi" <[EMAIL PROTECTED]>
To: "pyglet-users" <[email protected]>
Sent: Sunday, February 03, 2008 6:04 PM
Subject: Key handling memory leak?


>
> I wrote this simple thing:
>
> from pyglet import window
> from pyglet.window import key
>
> win = window.Window()
> keyboard = key.KeyStateHandler()
>
>
> while not win.has_exit:
>    win.dispatch_events()
>    win.push_handlers(keyboard)
>    win.flip()
>
>
>
> I ran that then opened Task Manager (I`m running XP SP2). The memory
> usage kept of this little program growing and growing. Have I done
> something wrong or is this a bug in pyglet?
> This is the current method I`m using for key press detection because
> this is the only one that allowed me to check if more than 1 button is
> pressed at the same time. Something along these lines:
> if keyboard[key.RIGHT] == True and keyboard[key.A] == True:
>    dance_around()
>
>
> >
>
>
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.19.19/1256 - Release Date: 
> 02/02/2008 13:50
>
> 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to