[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] GSoC



Entered as Issue 62 at Pygame issue tracker.

Lenard Lindstrom

On 06/02/11 03:35 PM, David Burton wrote:
Aha!  Thanks for this info, Greg and Lenard!!

Also, thanks, Lendard, I do think this is worth opening an issue about.

It seems that it is not a .dict() method, but a .dict attribute. It appears to be almost the equivalent of dir(), lacking the .type entry, but including the other attributes that matter:

Python 3.1.3 (r313:86834, Nov 27 2010, 18:30:53) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import pygame
>>> ev = pygame.event.Event( pygame.USEREVENT, {'id':'test', 'internal':False} )
>>> dict(ev)
Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    dict(ev)
TypeError: 'Event' object is not iterable
>>> ev.dict()
Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    ev.dict()
TypeError: 'dict' object is not callable
>>> ev.__dict__
Traceback (most recent call last):
  File "<pyshell#6>", line 1, in <module>
    ev.__dict__
AttributeError: event member not defined
>>> ev.dict
{'internal': False, 'id': 'test'}
>>>