Python - 'module' object has no attribute 'k_8'

 
Vista:

'module' object has no attribute 'k_8'

Publicado por f1l1p1n (2 intervenciones) el 15/02/2017 20:26:23
hola,
Al ejecutar este programa me da el error 'module' object has no attribute 'k_8'


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env python
# -*- coding: utf-8 -*-
 
 
import random, os, pygame, sys
from pygame.locals import *
 
inicio = 1
blanco = (255, 255, 255)
largo = 200
ancho = 200
fondo = pygame.image.load("imagenes/tablero.png")
ficha_c = pygame.image.load("imagenes/ficha_x.png")
ficha_p = pygame.image.load("imagenes/ficha_o.png")
pulsar = pygame.KEYDOWN
 
 
def inicio():
	pygame.init()
	# creamos la ventana y le indicamos un titulo:
	screen = pygame.display.set_mode((largo, ancho))
	pygame.display.set_caption("3 En raya")
	#Iteramos hasta que el usuario pulsa el botón de salir.
	hecho = False
	#Relog del juego
	reloj = pygame.time.Clock()
	#raton invisible
	pygame.mouse.set_visible(0)
	screen.blit(fondo, (0, 0))
	# se muestran lo cambios en pantalla
	pygame.display.flip()
 
 
	while not hecho:
        # Posibles entradas del teclado y mouse
		for event in pygame.event.get():
			if event.type == pygame.QUIT:
				hecho = True
 
			elif event.type == pulsar:
                                if event.key == pygame.k_8:
                                        ai = "1"
                                if event.key == pygame.k_8:
                                        am = "1"
                                if event.key == pygame.k_9:
                                        ad = "1"
                                if event.key == pygame.k_4:
                                        mi = "1"
                                if event.key == pygame.k_5:
                                        mm = "1"
                                if event.key == pygame.k_6:
                                        md = "1"
                                if event.key == pygame.k_1:
                                        bi = "1"
                                if event.key == pygame.k_2:
                                        bm = "1"
                                if event.key == pygame.k_3:
                                        bd = "1"
 
 
 
 
if __name__ == '__main__':
	inicio()
 
 
pygame.quit()

Que solucion me dais?
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de xve
Val: 2.239
Plata
Ha mantenido su posición en Python (en relación al último mes)
Gráfica de Python

'module' object has no attribute 'k_8'

Publicado por xve (1646 intervenciones) el 16/02/2017 08:12:05
Hola, prueba a poner la K en mayusculas...
1
pygame.K_8
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

'module' object has no attribute 'k_8'

Publicado por f1l1p1n (2 intervenciones) el 16/02/2017 20:17:39
Era eso graxx
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar