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

Re: [pygame] BUG: display.init() confuses key mods



I think maybe 512 is pygame.KMOD_ALT? it's what I use on python 2.3
for detecting alt-enter, and it works flawlessly:

           if event.key == pygame.K_RETURN and event.mod & pygame.KMOD_ALT:


On 8/12/06, Renà Dudfield <renesd@xxxxxxxxx> wrote:
weirdness...

This is from my full screen code...

                mods = event.mod

                # right alt modifier doesn't work it seems.
                #  So I use 512 as a constant...  seems to work.
                if (mods & K_LALT) or (mods & K_RALT) or (mods & 512):


Does that help?



On 8/13/06, Phil Hassey <philhassey@xxxxxxxxx> wrote:
> Well, after adding my small fix to the toggle_fullscreen function, it won't
> just go out of fullscreen if the user presses enter again, however it won't
> go out of full screen if the user presses alt-enter.  They have to do it
> twice then it goes out.
>
>  Not too big of a deal, but something still seems to be wrong...
>
>  Phil
>
>
> Phil Hassey <philhassey@xxxxxxxxx> wrote:
>  get_pressed also reports the incorrect value.  I think this is either a
> pygame or SDL issue.
>
>  However, I found that if I use pygame.key.set_mods(0)
> to reset the keyboard mods, that appears to fix the issue for the most part.
>  Kind of a hack though...
>
>  Phil
>
> Luke Paireepinart <rabidpoobear@xxxxxxxxx> wrote:
>  Phil Hassey wrote:
> > Hi,
> >
> > I noticed that when I used the sample:
> >
> >
> http://www.pygame.org/wiki/toggle_fullscreen?parent=CookBook
> >
> > To control my fullscreen toggling, after I went into full screen, I
> > could often just press enter (without the ALT) to get back to windowed
> > mode. After some playing around, it appears that either pygame or SDL
> > misses the ALT key-up event while switching into fullscreen mode... I
> > was able to reproduce this issue on both a linux and win32 system.
> >
> > Any suggestions? Am I doing something wrong in my toggle_fullscreen code?
> if you're using a separate variable to hold the state of the ALT key,
> you could just
> reset it to false whenever someone goes fullscreen,
> and then do a get_pressed or whatever to find out if alt actually still
> is pressed
> once you're fullscreened.
> >
> > Thanks!
> > Phil
> >
> >
> ------------------------------------------------------------------------
> > Do you Yahoo!?
> > Everyone is raving about the all-new Yahoo! Mail Beta.
> >
>
>
>
>  ________________________________
> Get your email and more, right on the new Yahoo.com
>
>
>  ________________________________
> How low will we go? Check out Yahoo! Messengerïs low PC-to-Phone call rates.
>
>