What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Python help

Python help
Author: Message:
Chancer
Senior Member
****

Avatar

Posts: 648
Reputation: 7
35 / Male / Flag
Joined: May 2005
Status: Away
O.P. RE: Python help
Here I am once again.
Our teacher told us to use pygame to create the interface, so I was wondering if it was possible to port that code you did to pygame libraries.

I made a big progress, but it's not good enough:

python code:
import pygame
from pygame.locals import *

def main():
    pygame.init()
    screen = pygame.display.set_mode((75, 55))
    screen = pygame.display.set_caption('Projeto 39')   
    screen = pygame.display.get_surface()
    background = pygame.Surface(screen.get_size())
    background = background.convert()
    background.fill((250, 255, 255))
    screen.blit(background, (0, 0))
   
    while True:
        for event in pygame.event.get():
            if event.type == QUIT or (event.type == KEYDOWN and event.key == K_ESCAPE):
                return        # Close window when clicking X ou hitting Escape
           
            elif event.type == KEYDOWN:        # Verify pressed keys
                key = pygame.key.get_pressed()
               
                if key[K_UP] and key[K_RIGHT]:
                    print 'AD'
               
                elif key[K_UP] and key[K_LEFT]:
                    print 'AE'
               
                elif key[K_DOWN] and key[K_RIGHT]:
                    print 'RD'
               
                elif key[K_DOWN] and key[K_LEFT]:
                    print 'RE'
               
                elif key[K_UP]:
                    print 'Ax'
               
                elif key[K_DOWN]:
                    print 'Rx'
               
                elif key[K_RIGHT]:
                    print 'xD'
               
                elif key[K_LEFT]:
                    print 'xE'
       
        screen.blit(background, (0, 0))
        pygame.display.flip()

main()
This does print the codes (AD, Ax, etc) when I press the keys, but it does it only once per keypress, and I need it to do it repeatedly.
What do you say? Is it possible?
09-26-2009 11:20 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Python help - by Chancer on 09-14-2009 at 01:47 AM
RE: Python help - by Ezra on 09-14-2009 at 05:23 PM
RE: Python help - by Chancer on 09-14-2009 at 08:55 PM
RE: Python help - by Jarrod on 09-15-2009 at 08:11 AM
RE: Python help - by Chancer on 09-15-2009 at 08:45 PM
RE: Python help - by matty on 09-16-2009 at 12:36 PM
RE: Python help - by Chancer on 09-16-2009 at 05:55 PM
RE: Python help, Solution :) - by Jarrod on 09-20-2009 at 01:33 PM
RE: Python help - by Chancer on 09-20-2009 at 03:26 PM
RE: Python help - by Jarrod on 09-20-2009 at 09:40 PM
RE: Python help - by Chancer on 09-20-2009 at 10:05 PM
RE: Python help - by Jarrod on 09-20-2009 at 10:08 PM
RE: Python help - by Chancer on 09-21-2009 at 01:06 AM
RE: Python help - by Jarrod on 09-21-2009 at 01:23 AM
RE: Python help - by Chancer on 09-26-2009 at 11:20 PM
RE: Python help - by Jarrod on 09-27-2009 at 09:35 AM
RE: Python help - by Chancer on 09-27-2009 at 02:39 PM
RE: Python help - by Jarrod on 09-27-2009 at 09:12 PM
RE: Python help - by Chancer on 09-27-2009 at 10:47 PM
RE: Python help - by Chancer on 10-04-2009 at 04:05 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On