Re: [pygame] pygame Event

2016-03-04 Thread Stuart Laatsc
Indeed, I'm on debian so I have pygame 1.9.1. Event.dict instead of
Event.__dict__ works great! Thank you!

On Fri, Mar 4, 2016 at 4:27 PM, Greg Ewing 
wrote:

> Stuart Laatsc wrote:
>
>> Well I don't really /need/ the __dict__ functionality, but it would be
>> /convenient/ to have /and it is included/ in the official documentation.
>>
>
> Are you sure you're not using an older version of pygame?
> If I remember rightly, Event used not to have '__dict__',
> only 'dict'.
>
> Pygame 1.9.2 seems to have both:
>
> >>> pygame.__version__
> '1.9.2pre'
> >> e = event.Event(42)
> ['__class__', '__delattr__', '__dict__', '__doc__', '__eq__',
> '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__',
> '__init__', '__le__', '__lt__', '__ne__', '__new__', '__nonzero__',
> '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__',
> '__str__', '__subclasshook__', 'dict', 'type']
> >>> e.__dict__ is e.dict
> True
>
> --
> Greg
>


Re: [pygame] pygame Event

2016-03-04 Thread Jake b
On Friday, March 4, 2016, Stuart Laatsc  wrote:

> Well I don't really *need* the __dict__ functionality, but it would be
> *convenient* to have
>

What are you trying to use it for?



-- 
Jake


Re: [pygame] pygame Event

2016-03-04 Thread Greg Ewing

Stuart Laatsc wrote:
Well I don't really /need/ the __dict__ functionality, but it would be 
/convenient/ to have /and it is included/ in the official documentation.


Are you sure you're not using an older version of pygame?
If I remember rightly, Event used not to have '__dict__',
only 'dict'.

Pygame 1.9.2 seems to have both:

>>> pygame.__version__
'1.9.2pre'
>> e = event.Event(42)
['__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', 
'__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', 
'__lt__', '__ne__', '__new__', '__nonzero__', '__reduce__', '__reduce_ex__', 
'__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'dict', 
'type']

>>> e.__dict__ is e.dict
True

--
Greg


Re: [pygame] pygame Event

2016-03-04 Thread Stuart Laatsc
Well I don't really *need* the __dict__ functionality, but it would be
*convenient* to have *and it is included* in the official documentation.

On Fri, Mar 4, 2016 at 2:44 AM, Martti Kühne  wrote:

> On Fri, Mar 4, 2016 at 6:55 AM, Ian Mallett  wrote:
> > As a sidenote, I haven't ever had occasion to use this functionality, as
> > there are more idiomatic and clear ways to retrieve information about
> > events' data.
> >
>
>
> This really is the key point here. Looking at events, you first check
> ev.type and will do different things based on the type anyway. And if
> you need to debug things, the respective string representation, str()
> and repr() both appear to boil down to the same, really informative
> result.
>
> cheers!
> mar77i
>


Re: [pygame] pygame Event

2016-03-04 Thread Stuart Laatsc
Interesting...

>>> import pygame>>> pygame.ver'1.9.1release'

I'll try to compile 1.9.2 from source, and get back to you

On Thu, Mar 3, 2016 at 11:55 PM, Ian Mallett  wrote:

> No, that is not a bug. The Events don't have a __dict__ attribute.
>>
> The attributes that events have are described in the documentation:
>>
> ​Umm, I think you are mistaken. Events are instances of
> "pygame.event.EventType", and the documentation you linked correctly shows
> ".__dict__" as an attribute.
>
> http://pastebin.com/qfKg2bAe http://pastebin.com/KQN8Fpc8
>>
> Thanks for providing an example. I wasn't able to reproduce the problem
> (that is, for me the ".__dict__" attribute exists and the example works as
> expected). Can you output your PyGame version? Try e.g. in a shell:
> >>> import pygame
> >>> pygame.ver
> Mine produces "1.9.2pre" (which might not be the latest).
>
> As a sidenote, I haven't ever had occasion to use this functionality, as
> there are more idiomatic and clear ways to retrieve information about
> events' data.
>
> Ian​
>
>


Re: [pygame] pygame Event

2016-03-04 Thread Martti Kühne
On Fri, Mar 4, 2016 at 6:55 AM, Ian Mallett  wrote:
> As a sidenote, I haven't ever had occasion to use this functionality, as
> there are more idiomatic and clear ways to retrieve information about
> events' data.
>


This really is the key point here. Looking at events, you first check
ev.type and will do different things based on the type anyway. And if
you need to debug things, the respective string representation, str()
and repr() both appear to boil down to the same, really informative
result.

cheers!
mar77i


Re: [pygame] pygame Event

2016-03-03 Thread Ian Mallett
>
> No, that is not a bug. The Events don't have a __dict__ attribute.
>
The attributes that events have are described in the documentation:
>
​Umm, I think you are mistaken. Events are instances of
"pygame.event.EventType", and the documentation you linked correctly shows
".__dict__" as an attribute.

http://pastebin.com/qfKg2bAe http://pastebin.com/KQN8Fpc8
>
Thanks for providing an example. I wasn't able to reproduce the problem
(that is, for me the ".__dict__" attribute exists and the example works as
expected). Can you output your PyGame version? Try e.g. in a shell:
>>> import pygame
>>> pygame.ver
Mine produces "1.9.2pre" (which might not be the latest).

As a sidenote, I haven't ever had occasion to use this functionality, as
there are more idiomatic and clear ways to retrieve information about
events' data.

Ian​


Re: [pygame] pygame Event

2016-03-03 Thread DiliupG
are you looking at a KEYDOWN event?
__dict__

Event object attribute dictionary
__dict__ -> dict

Read only. The event type specific attributes of an event. As an example,
this would contain the unicode, key, and mod attributes of a KEYDOWN event.
The dict attribute is a synonym, for backward compatibility.

On Fri, Mar 4, 2016 at 4:13 AM, Stuart Laatsc  wrote:

> I'm confused what is
> http://pygame.org/docs/ref/event.html#pygame.event.EventType.__dict__
> then?
>
> Thanks for your reply btw.
>
> On Thu, Mar 3, 2016 at 4:32 PM, Radomir Dopieralski 
> wrote:
>
>> On Thu, 3 Mar 2016 14:34:47 -0600
>> Lsc Student  wrote:
>>
>> > Hey everybody,
>> >
>> > I seem to be getting "AttributeError: event member not defined"
>> > whenever I attempt to call "event.__dict__". What's going on here? Is
>> > this a bug? Thanks in advance for any help.
>> >
>> > http://pastebin.com/qfKg2bAe http://pastebin.com/KQN8Fpc8
>>
>> No, that is not a bug. The Events don't have a __dict__ attribute.
>> The attributes that events have are described in the documentation:
>>
>> http://pygame.org/docs/ref/event.html
>>
>> --
>> Radomir Dopieralski
>>
>
>


-- 
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.
**


Re: [pygame] pygame Event

2016-03-03 Thread Stuart Laatsc
I'm confused what is
http://pygame.org/docs/ref/event.html#pygame.event.EventType.__dict__ then?

Thanks for your reply btw.

On Thu, Mar 3, 2016 at 4:32 PM, Radomir Dopieralski 
wrote:

> On Thu, 3 Mar 2016 14:34:47 -0600
> Lsc Student  wrote:
>
> > Hey everybody,
> >
> > I seem to be getting "AttributeError: event member not defined"
> > whenever I attempt to call "event.__dict__". What's going on here? Is
> > this a bug? Thanks in advance for any help.
> >
> > http://pastebin.com/qfKg2bAe http://pastebin.com/KQN8Fpc8
>
> No, that is not a bug. The Events don't have a __dict__ attribute.
> The attributes that events have are described in the documentation:
>
> http://pygame.org/docs/ref/event.html
>
> --
> Radomir Dopieralski
>


Re: [pygame] pygame Event

2016-03-03 Thread Radomir Dopieralski
On Thu, 3 Mar 2016 14:34:47 -0600
Lsc Student  wrote:

> Hey everybody,
> 
> I seem to be getting "AttributeError: event member not defined"
> whenever I attempt to call "event.__dict__". What's going on here? Is
> this a bug? Thanks in advance for any help.
> 
> http://pastebin.com/qfKg2bAe http://pastebin.com/KQN8Fpc8

No, that is not a bug. The Events don't have a __dict__ attribute.
The attributes that events have are described in the documentation:

http://pygame.org/docs/ref/event.html

-- 
Radomir Dopieralski


[pygame] pygame Event

2016-03-03 Thread Lsc Student
Hey everybody,

I seem to be getting "AttributeError: event member not defined" whenever I
attempt to call "event.__dict__". What's going on here? Is this a bug?
Thanks in advance for any help.

http://pastebin.com/qfKg2bAe http://pastebin.com/KQN8Fpc8

Best regards,
~Stu


Re: [pygame] Pygame Event System

2006-12-19 Thread Pete Shinners
On Tue, 2006-12-19 at 11:50 -0400, Ben Woodhead wrote:
 I have an extra library that generates SDL events and I have been looking at 
 how pygame gets events. I was wondering if anybody knew the best way to 
 incorperate the new events into pygames.

Pygame will get all the events that SDL receives. You will definitely
get the ID of the event. If it is in the range of SDL user events
you can access the code member of the user event structure.

Reading other data from the event will be tricky. Something might be
doable with ctypes? But pygame doesn't deliver any of the other fields
in the user event structure.