|
|
Subject: Re: Not getting mouse up event - msg#00040
List: python.pygame
On Mon, 29 Nov 2004 08:33:54 +0000, Austin Haas
<pygame-d7ULYePVvGxFRy1+8LAogg@xxxxxxxxxxxxxxxx> wrote:
>
> I tried 'pump,' but it didn't help. I don't totally understand 'pump,' but
> what I gather from the documentation is that, so long as you are making a
> call to 'event' every tick, then you don't need it.
>
> I am using Gentoo Linux and Pygame 1.6.1.
>
> Also, the code I submitted was new, right before I mailed it, and I found that
> it was also causing the input to frequently lock up. The game would be
> running, but after a few seconds, all input, including clicking on the 'x' in
> the window, would be disabled. I can't understand why.
The problem in the code you originally posted is probably that the
event queue is getting full since you only grab certain events out of
it (probably from MOUSEMOVE events). Use event.set_blocked to filter
out the events that you don't need and just call event.get(). Not sure
if this will affect the MOUSEUP problem in your revised code, though.
--
Sami Hangaslammi
Was this page helpful?
Thread at a glance:
Previous Message by Date:
click to view message preview
Re: Not getting mouse up event
I don't see event.getkeys() in the documentation. Can you tell me where to
find it?
On Monday 29 November 2004 03:10 am, andrew baker wrote:
> It sounds like you need to pump the event queue. I use in
> event.getkeys(), so I don't need to pump the queue, but you're using
> Getinput, so I guess you might need to.
>
> On Sun, 28 Nov 2004 17:55:38 -0800, Fred Burton
> <flbl-uDRvFXH9+woi6nXLkHzePQ@xxxxxxxxxxxxxxxx> wrote:
> > Austin Haas wrote:
> > >I am having an issue where I'm occasionally not receiving the
> > > MOUSEBUTTONUP event from the event queue, until I execute another mouse
> > > event.
> >
> > ..
> >
> > >Anyone know what's going on?
> > >
> > >(Also, the cursor page in the online documentation is NOT FOUND.)
> > >
> > >-austin
> >
> > What OS and version of pygame are you using?
Next Message by Date:
click to view message preview
Re: Not getting mouse up event
Austin Haas wrote:
The keyboard events will come through fine, but the MOUSEBUTTONUP will not be
picked up until I move the mouse, or press another button. The instant I move
the mouse, it fires, even if I had released it moments ago. It only seems to
lock up if I hold the button down for ~8+ seconds.
There is an example program that comes with pygame called "eventlist".
This opens a window and simply logs all pygame events as they show up.
Try doing the same operations and see how the mouse messages show up.
If it seems ok in the example then I suspect your multiple event.get
calls. In any event, after getting all your event sorted you should call
pygame.event.clear() to get rid of other things that may be building up
on the queue.
(Also, the cursor page in the online documentation is NOT FOUND.)
check.
Previous Message by Thread:
click to view message preview
Re: Not getting mouse up event
I tried 'pump,' but it didn't help. I don't totally understand 'pump,' but
what I gather from the documentation is that, so long as you are making a
call to 'event' every tick, then you don't need it.
I am using Gentoo Linux and Pygame 1.6.1.
Also, the code I submitted was new, right before I mailed it, and I found that
it was also causing the input to frequently lock up. The game would be
running, but after a few seconds, all input, including clicking on the 'x' in
the window, would be disabled. I can't understand why.
Here's that code again:
key_ups = [event.key for event in pygame.event.get(KEYUP)]
mouse_ups = [event.button for event in pygame.event.get(MOUSEBUTTONUP)]
key_downs = [event.key for event in pygame.event.get(KEYDOWN)]
mouse_downs = [event.button for event in pygame.event.get(MOUSEBUTTONDOWN)]
if K_ESCAPE in key_downs or pygame.event.peek(QUIT):
sys.exit()
I changed it back to this:
key_ups = []
key_downs = []
mouse_ups = []
mouse_downs = []
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
elif event.type == KEYUP:
key_ups.append( event.key )
elif event.type == KEYDOWN:
if event.key == K_ESCAPE:
sys.exit()
else:
key_downs.append( event.key )
elif event.type == MOUSEBUTTONDOWN:
mouse_downs.append( event.button )
elif event.type == MOUSEBUTTONUP:
mouse_ups.append( event.button )
...but this hasn't had any affect on my original, not getting mouse up, issue.
-austin
On Monday 29 November 2004 03:10 am, andrew baker wrote:
> It sounds like you need to pump the event queue. I use in
> event.getkeys(), so I don't need to pump the queue, but you're using
> Getinput, so I guess you might need to.
>
> On Sun, 28 Nov 2004 17:55:38 -0800, Fred Burton
> <flbl-uDRvFXH9+woi6nXLkHzePQ@xxxxxxxxxxxxxxxx> wrote:
> > Austin Haas wrote:
> > >I am having an issue where I'm occasionally not receiving the
> > > MOUSEBUTTONUP event from the event queue, until I execute another mouse
> > > event.
> >
> > ..
> >
> > >Anyone know what's going on?
> > >
> > >(Also, the cursor page in the online documentation is NOT FOUND.)
> > >
> > >-austin
> >
> > What OS and version of pygame are you using?
Next Message by Thread:
click to view message preview
Re: Not getting mouse up event
I don't see event.getkeys() in the documentation. Can you tell me where to
find it?
On Monday 29 November 2004 03:10 am, andrew baker wrote:
> It sounds like you need to pump the event queue. I use in
> event.getkeys(), so I don't need to pump the queue, but you're using
> Getinput, so I guess you might need to.
>
> On Sun, 28 Nov 2004 17:55:38 -0800, Fred Burton
> <flbl-uDRvFXH9+woi6nXLkHzePQ@xxxxxxxxxxxxxxxx> wrote:
> > Austin Haas wrote:
> > >I am having an issue where I'm occasionally not receiving the
> > > MOUSEBUTTONUP event from the event queue, until I execute another mouse
> > > event.
> >
> > ..
> >
> > >Anyone know what's going on?
> > >
> > >(Also, the cursor page in the online documentation is NOT FOUND.)
> > >
> > >-austin
> >
> > What OS and version of pygame are you using?
|
|