I called event.clear() cause it says in the Pygame documentation that if you leave unused events on the buffer that eventually it may fill up and cause the program to crash.
Also can you explain why if x is True: is not correct and if x == True is correct? On Mon, Jun 23, 2014 at 11:34 AM, Greg Ewing <greg.ew...@canterbury.ac.nz> wrote: > diliup gabadamudalige wrote: > >> pygame.event.clear() >> before exiting the function >> >> somehow when I removed that line the error stopped. >> > > That would definitely be it! You were throwing away any > events that came in between calling event.get() and > reaching the end of your function. Not a good idea when > you rely critically on seeing *all* key up events. > > I don't know why you thought you needed to call > event.clear(), but whatever your reason was, it was > probably wrong. > > > So may be I had to keep all the unused events for the next time the loop >> was entered. Is that correct? >> > > Exactly correct. > > -- > Greg > -- Diliup Gabadamudalige http://www.diliupg.com http://soft.diliupg.com/ ********************************************************************************************** This e-mail is confidential. It may also be legally privileged. If you are not the intended recipient or have received it in error, please delete it and all copies from your system and notify the sender immediately by return e-mail. Any unauthorized reading, reproducing, printing or further dissemination of this e-mail or its contents is strictly prohibited and may be unlawful. Internet communications cannot be guaranteed to be timely, secure, error or virus-free. The sender does not accept liability for any errors or omissions. **********************************************************************************************