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?