Re: [pygame] Keyboard events problem in Mac OS X 10.6 Snow Leopard
Glad it worked Math. On 4/3/10 9:17 AM, Mathieu Richardoz wrote: Thanks a lot for pointing me to ActivePython, it's working like a charm, and I didn't even have to reinstall PyGame :D I am now wondering if maybe, juste maybe, I could run my Django projects on top of this Python as well, but I guess that is well beyond the scope of this list, so I'll shut up now ^_^ Best regards from a rainy Paris afternoon. Math
Re: [pygame] Keyboard events problem in Mac OS X 10.6 Snow Leopard
Thanks a lot for pointing me to ActivePython, it's working like a charm, and I didn't even have to reinstall PyGame :D I am now wondering if maybe, juste maybe, I could run my Django projects on top of this Python as well, but I guess that is well beyond the scope of this list, so I'll shut up now ^_^ Best regards from a rainy Paris afternoon. Math
Re: [pygame] Keyboard events problem in Mac OS X 10.6 Snow Leopard
I believe I installed the binary from the PyGame website after installing ActivePython. No trouble at all. On 4/3/10 9:05 AM, Mathieu Richardoz wrote: Thanks Dan. That's it, the red box doesn't move, and when I press the arrow keys, I see the keypresses being echoed inside the terminal, which makes me assume they are not being "seen" by my pygame window. I've tried to implement other event types, such as MOUSEBUTTONUP and MOUSEBUTTONDOWN and they work fine. I'm going to try to install ActivePython as well, who knows. May I ask how you installed PyGame on top of it? Was it straightforward or did you have to jump through hoops? ;-) Math
Re: [pygame] Keyboard events problem in Mac OS X 10.6 Snow Leopard
Thanks Dan. That's it, the red box doesn't move, and when I press the arrow keys, I see the keypresses being echoed inside the terminal, which makes me assume they are not being "seen" by my pygame window. I've tried to implement other event types, such as MOUSEBUTTONUP and MOUSEBUTTONDOWN and they work fine. I'm going to try to install ActivePython as well, who knows. May I ask how you installed PyGame on top of it? Was it straightforward or did you have to jump through hoops? ;-) Math
Re: [pygame] Keyboard events problem in Mac OS X 10.6 Snow Leopard
Not really. In fact, it works fine on my 10.6.2 MacBook Pro. A difference would be that I use ActivePython rather that MacPorts Python. Does the screen appear on your machine? The red box just doesn't move? On 4/3/10 8:54 AM, Mathieu Richardoz wrote: Hi Dan, Thank you for your reply :-) Here's the code: --- import pygame pygame.init() screen = pygame.display.set_mode((640, 480)) background = pygame.Surface(screen.get_size()) background = background.convert() background.fill((0, 0, 255)) box = pygame.Surface((25, 25)) box = box.convert() box.fill((255, 0, 0)) box_x = 200 box_y = 200 clock = pygame.time.Clock() playing = True while playing: clock.tick(30) for event in pygame.event.get(): if event.type == pygame.QUIT: playing = False keys = pygame.key.get_pressed() if keys[pygame.K_UP]: box_y -= 5 if keys[pygame.K_DOWN]: box_y += 5 if keys[pygame.K_LEFT]: box_x -= 5 if keys[pygame.K_RIGHT]: box_x += 5 screen.blit(background, (0, 0)) screen.blit(box, (box_x, box_y)) pygame.display.flip() --- Do you see anything I might have done wrong? Math
Re: [pygame] Keyboard events problem in Mac OS X 10.6 Snow Leopard
Hi Dan, Thank you for your reply :-) Here's the code: --- import pygame pygame.init() screen = pygame.display.set_mode((640, 480)) background = pygame.Surface(screen.get_size()) background = background.convert() background.fill((0, 0, 255)) box = pygame.Surface((25, 25)) box = box.convert() box.fill((255, 0, 0)) box_x = 200 box_y = 200 clock = pygame.time.Clock() playing = True while playing: clock.tick(30) for event in pygame.event.get(): if event.type == pygame.QUIT: playing = False keys = pygame.key.get_pressed() if keys[pygame.K_UP]: box_y -= 5 if keys[pygame.K_DOWN]: box_y += 5 if keys[pygame.K_LEFT]: box_x -= 5 if keys[pygame.K_RIGHT]: box_x += 5 screen.blit(background, (0, 0)) screen.blit(box, (box_x, box_y)) pygame.display.flip() --- Do you see anything I might have done wrong? Math
Re: [pygame] Keyboard events problem in Mac OS X 10.6 Snow Leopard
Hi Math- Could you post some of your key event code for us to look at? On 4/3/10 8:03 AM, Mathieu Richardoz wrote: Hello fellow PyGamers, I have a very annoying problem with my PyGame installation under Mac OS X 10.6 Snow Leopard. When I execute a PyGame program from the Terminal, the keys I press are not sent to the game window but to the Terminal window itself, where they are echoed, which means that no key presses are ever detected by my program :'( I've been googling that problem for the past couple of hours, and the only reference to it I've found is this post: http://www.mail-archive.com/pygame-users@seul.org/msg09102.html , to which there was no conclusive answer. I've installed pygame through MacPorts, where it depends upon the python24 package. I thus run it through Python 2.4.6. I even tried to force grab the focus with pygame.event.set_grab(True), but the behaviour remains the same. Thanks in advance for any help you could provide on that matter. Math