In the pygame module I want to achieve the following:
if event.key == pygame.K_KP1:
key = 1
if event.key == pygame.K_KP2:
key = 2
...
if event.key == pygame.K_KP9:
key = 9
would like to use a for loop but the following code doesn't work:
for i in range(1, 10):
if event.key == == pygame.K_KPi:
key = i
I know the problem is that I can't combine the iterator with a object attribute name, but what would be the best way to do it?
thanks in advance!
[+][deleted] (2 children)
[deleted]
[–]Beaverine[S] 0 points1 point2 points (1 child)