Hi, Amaury.

The docs recommend that event.type stay between NOEVENT and NUMEVENTS. So
you are restricted to that range. Not sure if this is the cause of the
inconsistencies you're seeing, but Pygame can be expected to work on any
support platform if you follow the rules.

Even though your choice of Event type is restricted, you can put virtually
anything you want in your own events. This opens up a huge potential for
customization.

For example, you could use an attribute like "usertype" to store any number
of user event  types. And you are not restricted in regards to its contents,
or even a particular data type. And you can have any number of attributes.

Here is one way to make your own event types.

e = Event(USEREVENT, usertype='alist', userdata=[1,2,3,4])
pygame.event.post(e)
...
for e in pygame.event.get():
if e.type == USEREVENT:
if e.usertype == 'alist':
print e.usertype, e.userdata

Note tou probably do not want to use spaces in your dict keys, like you did
in the example. If you do, you will need to use getattr() to access them.

Hope this helps.

Gumm

On Mon, Jan 25, 2010 at 4:10 PM, Amaury Lepicard <amaury.lepic...@ensc.fr>wrote:

> program works well
> qith the values 42 and 43. This may not be possible, isn't it?
>

Reply via email to