Что за ошибка
AttributeError: module 'pygame' has no attribute 'init'
?
import sys
import pygame
pygame.init()
def main():
pygame.init()
pygame.font.init()
size = width, height = 600, 600
surface = pygame.display.set_mode(size)
font = pygame.font.SysFont('Console', 24)
fps = pygame.time.Clock()
board = [
[1,2,3,4]
[5,6,7,8]
[9,10,11,12]
[13,14,15,0]
]
dorun = True
while dorun:
fps.tick(60)
pos = None
for event in pygame.event.get():
if event.type == pygame.QUIT: sys.exit()
if event.type == pygame.MOUSEBUTTONDOUN:
pos = pygame.mouse.get_pos()
surface.fill(pygame.Color(0,0,0))
for x in range(4):
for y in range(4):
rect = pygame.Rect(150*x +10, y*150, 130, 130)
if pos:
rect.collidepoint(pos)
print('Mouse is clicked at %ix%i piece' %(x, y))
pygame.draw.rect(surface, pygame.Color(255,255,255), rect)
pygame.display.flip()
if __name__=="__main__":
main()