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

Re: [pygame] event getting corrupted





On Wed, Sep 16, 2009 at 5:18 PM, Bo Jangeborg <bo@xxxxxxxxxxx> wrote:

a ha
Well, from where comes event ?

event = pyg_event.poll()

but note that a long can't have attributes and 13 lines above the
error point I do :

mouse_pos = event.pos

and it works at that time

pyg_event.poll is pygame.event.poll ?
If the only fountain for events were the pygame event queue, the traceback coulnt happen:

a)
elif event.type is MOUSEBUTTONUP:
   -> dont, raises, so is not a long

b) the flow comes to
_,_,_ = self.mouse_button_up(event, mob_pos, mousemove)

c)into method mouse_button_up event will become a local variable. That variable is not assigned, at least in the code you show here. 

d) the flow progress to the line
if event.button == 1:
where it raises AttributeError: 'long' object has no attribute 'button'

I see two possibilities here:

1. You snipped some code where event is assigned

2. ( wild possibility) the functions called in mouse_button_up will produce a *second* call with other parameters to the same function, and that call has a wrong event parameter. But, why the traceback not show additional calls in that case?

--
claxo