Re: [pygame] Segmentation Fault in PolyPlay 1.3 Walker demo

2008-04-08 Thread Lenard Lindstrom

Marcus von Appen wrote:

Fixed in rev. 1190 now. Can someone try the PolyPlay demo again with it?

Regards
Marcus
  

PolyPlay now works. Thanks.

--
Lenard Lindstrom
<[EMAIL PROTECTED]>



Re: [pygame] full keyboard control

2008-04-08 Thread Brian Davis
Yep. That was the quick and dirty way.

On Tue, Apr 8, 2008 at 1:22 PM, Brian Fisher <[EMAIL PROTECTED]> wrote:
> doesn't that code block tab entirely? as opposed to just alt-tab?
>
>
>
>  On Tue, Apr 8, 2008 at 11:24 AM, Brian Davis <[EMAIL PROTECTED]> wrote:
>  > pyHook looks to be the way to go. I just posted a recipe to the ASPN
>  >  cookbook that is basically the example Brian F. linked to above with a
>  >  few mods to block the windows key and alt-tab and use the pygame event
>  >  pump. No matter what you do pyHook won't block the ctrl-alt-del
>  >  combination which seems like a good thing.
>  >
>  >  Here's the link to the recipe:
>  >  http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/553270
>  >  And the code if that link doesn't work:
>  >  import pyHook
>  >  import pygame
>  >
>  >  # create a keyboard hook
>  >  def OnKeyboardEvent(event):
>  > print 'MessageName:',event.MessageName
>  > print 'Message:',event.Message
>  > print 'Time:',event.Time
>  > print 'Window:',event.Window
>  > print 'WindowName:',event.WindowName
>  > print 'Ascii:', event.Ascii, chr(event.Ascii)
>  > print 'Key:', event.Key
>  > print 'KeyID:', event.KeyID
>  > print 'ScanCode:', event.ScanCode
>  > print 'Extended:', event.Extended
>  > print 'Injected:', event.Injected
>  > print 'Alt', event.Alt
>  > print 'Transition', event.Transition
>  > print '---'
>  > if event.Key.lower() in ['lwin', 'tab', 'lmenu']:
>  > return False# block these keys
>  > else:
>  > # return True to pass the event to other handlers
>  > return True
>  >
>  >  # create a hook manager
>  >  hm = pyHook.HookManager()
>  >  # watch for all keyboard events
>  >  hm.KeyDown = OnKeyboardEvent
>  >  # set the hook
>  >  hm.HookKeyboard()
>  >
>  >  # initialize pygame and start the game loop
>  >  pygame.init()
>  >
>  >  while(1):
>  > pygame.event.pump()
>  >
>  >  Thanks to everbody for the help!
>  >
>  >  -Brian
>  >
>



-- 
Brian Davis
[EMAIL PROTECTED]
[EMAIL PROTECTED]


Re: [pygame] full keyboard control

2008-04-08 Thread Brian Fisher
doesn't that code block tab entirely? as opposed to just alt-tab?

On Tue, Apr 8, 2008 at 11:24 AM, Brian Davis <[EMAIL PROTECTED]> wrote:
> pyHook looks to be the way to go. I just posted a recipe to the ASPN
>  cookbook that is basically the example Brian F. linked to above with a
>  few mods to block the windows key and alt-tab and use the pygame event
>  pump. No matter what you do pyHook won't block the ctrl-alt-del
>  combination which seems like a good thing.
>
>  Here's the link to the recipe:
>  http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/553270
>  And the code if that link doesn't work:
>  import pyHook
>  import pygame
>
>  # create a keyboard hook
>  def OnKeyboardEvent(event):
> print 'MessageName:',event.MessageName
> print 'Message:',event.Message
> print 'Time:',event.Time
> print 'Window:',event.Window
> print 'WindowName:',event.WindowName
> print 'Ascii:', event.Ascii, chr(event.Ascii)
> print 'Key:', event.Key
> print 'KeyID:', event.KeyID
> print 'ScanCode:', event.ScanCode
> print 'Extended:', event.Extended
> print 'Injected:', event.Injected
> print 'Alt', event.Alt
> print 'Transition', event.Transition
> print '---'
> if event.Key.lower() in ['lwin', 'tab', 'lmenu']:
> return False# block these keys
> else:
> # return True to pass the event to other handlers
> return True
>
>  # create a hook manager
>  hm = pyHook.HookManager()
>  # watch for all keyboard events
>  hm.KeyDown = OnKeyboardEvent
>  # set the hook
>  hm.HookKeyboard()
>
>  # initialize pygame and start the game loop
>  pygame.init()
>
>  while(1):
> pygame.event.pump()
>
>  Thanks to everbody for the help!
>
>  -Brian
>


Re: [pygame] full keyboard control

2008-04-08 Thread Brian Davis
pyHook looks to be the way to go. I just posted a recipe to the ASPN
cookbook that is basically the example Brian F. linked to above with a
few mods to block the windows key and alt-tab and use the pygame event
pump. No matter what you do pyHook won't block the ctrl-alt-del
combination which seems like a good thing.

Here's the link to the recipe:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/553270
And the code if that link doesn't work:
import pyHook
import pygame

# create a keyboard hook
def OnKeyboardEvent(event):
print 'MessageName:',event.MessageName
print 'Message:',event.Message
print 'Time:',event.Time
print 'Window:',event.Window
print 'WindowName:',event.WindowName
print 'Ascii:', event.Ascii, chr(event.Ascii)
print 'Key:', event.Key
print 'KeyID:', event.KeyID
print 'ScanCode:', event.ScanCode
print 'Extended:', event.Extended
print 'Injected:', event.Injected
print 'Alt', event.Alt
print 'Transition', event.Transition
print '---'
if event.Key.lower() in ['lwin', 'tab', 'lmenu']:
return False# block these keys
else:
# return True to pass the event to other handlers
return True

# create a hook manager
hm = pyHook.HookManager()
# watch for all keyboard events
hm.KeyDown = OnKeyboardEvent
# set the hook
hm.HookKeyboard()

# initialize pygame and start the game loop
pygame.init()

while(1):
pygame.event.pump()

Thanks to everbody for the help!

-Brian


Re: [pygame] full keyboard control

2008-04-08 Thread Brian Davis
I just tested the registry hacks that google found me and they both
require rebooting. (NoWinKeys and Scancode Map hacks)
I have found a freeware program called WinKey Killer that you can
configure to lock out certain keys (including ctrl-alt-del oddly
enough). Which I could run from a batch file if nothing else.
However the pyhook library looks exactly like what I was looking for.
I will dig into it a bit and see if it will do the trick.
Thanks all, I'll report back on what I find.
-Brian

On Tue, Apr 8, 2008 at 9:56 AM, Brian Fisher <[EMAIL PROTECTED]> wrote:
> The registry disabling would certainly be good except I think it only
>  works after a reboot :(
>
>  Apps I know that have done this install a Low Level keyboard hook
>  using SetWindowsHookEx, which lets you trap all keybaord events before
>  they get processed and block them (including system stuff).
>  Unfortunately this is also what keyboard loggers do, and I'm sure
>  would have Vista-specific difficulties (if it's still possible), so
>  although it would be perfect for helping your daughter play a game
>  without reboots to get things back to normal, it's not something that
>  would distribute well.
>
>  a good search for "python "SetWindowsHookEx" pointed my to "pyHook",
>  which seems to be able to do what you want:
>  http://www.mindtrove.info/articles/pyhook.html
>
>
>
>  On Tue, Apr 8, 2008 at 9:39 AM, James Paige <[EMAIL PROTECTED]> wrote:
>  >  Run your daughter's game with a batch file that first imports the .reg
>  >  file into the registry, and then launches the pygame application.
>  >
>



-- 
Brian Davis
[EMAIL PROTECTED]
[EMAIL PROTECTED]


Re: [pygame] full keyboard control

2008-04-08 Thread Brian Fisher
The registry disabling would certainly be good except I think it only
works after a reboot :(

Apps I know that have done this install a Low Level keyboard hook
using SetWindowsHookEx, which lets you trap all keybaord events before
they get processed and block them (including system stuff).
Unfortunately this is also what keyboard loggers do, and I'm sure
would have Vista-specific difficulties (if it's still possible), so
although it would be perfect for helping your daughter play a game
without reboots to get things back to normal, it's not something that
would distribute well.

a good search for "python "SetWindowsHookEx" pointed my to "pyHook",
which seems to be able to do what you want:
http://www.mindtrove.info/articles/pyhook.html

On Tue, Apr 8, 2008 at 9:39 AM, James Paige <[EMAIL PROTECTED]> wrote:
>  Run your daughter's game with a batch file that first imports the .reg
>  file into the registry, and then launches the pygame application.
>


Re: [pygame] full keyboard control

2008-04-08 Thread Wyatt Olson
I could be wrong here (I have not used Windows for years), but I thought 
that the whole point of Ctrl Alt Delete to login was that this sequence 
of keys could not be grabbed by anything other than the OS itself - it 
is a 'secure channel' or something like that.  My guess is that you will 
not be able to intercept this with a user level process, because that 
would defeat the security of this key sequence.  (Basically, if you hit 
Ctrl Alt Delete, you can be sure that there is no trojan putting up a 
'login' screen to steal your password).


Cheers

Lamonte(Scheols/Demonic) wrote:
I'm pretty sure if you set full screen mode and do checks to see if 
they pressed ctrl+alt+del do nothing :)


On Tue, Apr 8, 2008 at 11:22 AM, Brian Davis <[EMAIL PROTECTED] 
> wrote:


I've read these arguments elsewhere and fully agree with them, except
in this case. What I'm making is a program for my 1 year-old daughter
to bang on the keyboard and hear cool sounds and see colors change on
the screen. So I suppose ctrl-alt-delete isn't a big worry but the
windows key definitely is! And even alt-tab would be possible for her
to hit. The only option I've found so far is a registry hack and I
haven't tested it out yet. Does anyone know if there are any options
in pygame or SDL for disabling the windows key(s)?

I should have said what I was doing in my original email. Sorry.

Thanks,
-Brian

On Mon, Apr 7, 2008 at 6:59 PM, Greg Ewing
<[EMAIL PROTECTED] >
wrote:
> Ian Mallett wrote:
>
> >  I don't think so.  Think about it.  If your program were to crash
> > and lock up, the only way to stop it would be to restart the
computer.
> >
>
>  Besides, it annoys me when a game has the audacity to
>  assume I won't want to do *anything* else with my
>  computer while it's running. Like switching away to
>  consult a hints file, for instance.
>
>  --
>  Greg
>




--
Join cleanscript.com  Come here for 
professional PHP coding. 


Re: [pygame] full keyboard control

2008-04-08 Thread Lamonte(Scheols/Demonic)
I'm pretty sure if you set full screen mode and do checks to see if they
pressed ctrl+alt+del do nothing :)

On Tue, Apr 8, 2008 at 11:22 AM, Brian Davis <[EMAIL PROTECTED]> wrote:

> I've read these arguments elsewhere and fully agree with them, except
> in this case. What I'm making is a program for my 1 year-old daughter
> to bang on the keyboard and hear cool sounds and see colors change on
> the screen. So I suppose ctrl-alt-delete isn't a big worry but the
> windows key definitely is! And even alt-tab would be possible for her
> to hit. The only option I've found so far is a registry hack and I
> haven't tested it out yet. Does anyone know if there are any options
> in pygame or SDL for disabling the windows key(s)?
>
> I should have said what I was doing in my original email. Sorry.
>
> Thanks,
> -Brian
>
> On Mon, Apr 7, 2008 at 6:59 PM, Greg Ewing <[EMAIL PROTECTED]>
> wrote:
> > Ian Mallett wrote:
> >
> > >  I don't think so.  Think about it.  If your program were to crash
> > > and lock up, the only way to stop it would be to restart the computer.
> > >
> >
> >  Besides, it annoys me when a game has the audacity to
> >  assume I won't want to do *anything* else with my
> >  computer while it's running. Like switching away to
> >  consult a hints file, for instance.
> >
> >  --
> >  Greg
> >
>



-- 
Join cleanscript.com Come here for professional PHP coding.


Re: [pygame] full keyboard control

2008-04-08 Thread James Paige
Disabling the special keys on the operating-system level is going to be 
much easier than disabling them on a pygame/SDL level.

What you are trying to do is fairly common, you are trying to create a 
"Kiosk" application.

Since you have a registry hack, I suggest that  you write two .reg 
files, one that disables the keys and another that enables the keys.

Run your daughter's game with a batch file that first imports the .reg 
file into the registry, and then launches the pygame application.

Run a batch file in your startup that imports the other .reg file, so 
that your special keys work again after a reboot.

---
James

On Tue, Apr 08, 2008 at 09:22:54AM -0700, Brian Davis wrote:
> I've read these arguments elsewhere and fully agree with them, except
> in this case. What I'm making is a program for my 1 year-old daughter
> to bang on the keyboard and hear cool sounds and see colors change on
> the screen. So I suppose ctrl-alt-delete isn't a big worry but the
> windows key definitely is! And even alt-tab would be possible for her
> to hit. The only option I've found so far is a registry hack and I
> haven't tested it out yet. Does anyone know if there are any options
> in pygame or SDL for disabling the windows key(s)?
> 
> I should have said what I was doing in my original email. Sorry.
> 
> Thanks,
> -Brian
> 
> On Mon, Apr 7, 2008 at 6:59 PM, Greg Ewing <[EMAIL PROTECTED]> wrote:
> > Ian Mallett wrote:
> >
> > >  I don't think so.  Think about it.  If your program were to crash
> > > and lock up, the only way to stop it would be to restart the computer.
> > >
> >
> >  Besides, it annoys me when a game has the audacity to
> >  assume I won't want to do *anything* else with my
> >  computer while it's running. Like switching away to
> >  consult a hints file, for instance.
> >
> >  --
> >  Greg
> >
> 
> 


Re: [pygame] full keyboard control

2008-04-08 Thread Brian Davis
I've read these arguments elsewhere and fully agree with them, except
in this case. What I'm making is a program for my 1 year-old daughter
to bang on the keyboard and hear cool sounds and see colors change on
the screen. So I suppose ctrl-alt-delete isn't a big worry but the
windows key definitely is! And even alt-tab would be possible for her
to hit. The only option I've found so far is a registry hack and I
haven't tested it out yet. Does anyone know if there are any options
in pygame or SDL for disabling the windows key(s)?

I should have said what I was doing in my original email. Sorry.

Thanks,
-Brian

On Mon, Apr 7, 2008 at 6:59 PM, Greg Ewing <[EMAIL PROTECTED]> wrote:
> Ian Mallett wrote:
>
> >  I don't think so.  Think about it.  If your program were to crash
> > and lock up, the only way to stop it would be to restart the computer.
> >
>
>  Besides, it annoys me when a game has the audacity to
>  assume I won't want to do *anything* else with my
>  computer while it's running. Like switching away to
>  consult a hints file, for instance.
>
>  --
>  Greg
>


Re: [pygame] Segmentation Fault in PolyPlay 1.3 Walker demo

2008-04-08 Thread Marcus von Appen
Fixed in rev. 1190 now. Can someone try the PolyPlay demo again with it?

Regards
Marcus


pgpq9eUNy8MHA.pgp
Description: PGP signature