ошибка builtin_function_or_method

Составил небольшую программу, что бы управлять объектами, а она не работает. выдает две ошибки.

Traceback (most recent call last):
  line 52, in <module>
    move (head)
  line 20, in move
    if keys [K_UP] :
TypeError: 'builtin_function_or_method' object is not subscriptable
import pygame
from pygame.locals import *
from random import randint

#################################

pygame.init ()
pygame.display.set_caption ("shrek")
win = pygame.display.set_mode ((800, 600))
clock = pygame.time.Clock ()
################################
fps = 30
derection = (2,0)
color = (0, 123, 33)
head = Rect ((400, 300), (30, 30))
################################

def move(head):
    global derection , keys
    if keys [K_UP] :
        derection = [0, -2]
    elif keys [K_DOWN] :
        derection = [0, 2]
    elif keys [K_RIGHT] :
        derection = [2, 0]
    elif keys [K_LEFT] :
        derection = [-2, 0]
####
    if head.bottom > 600:
        derection = [0, -2]
    elif head.top < 0:
        derection = [0, 2]
    elif head.right > 800:
        derection = [-2 , 0]
    elif head.left < 0:
        derection = [2 , 0]
    head.move_ip (derection)
################################

while True:
    clock.tick(fps)
    win.fill ((0,0,0))
    for i in pygame.event.get():
        if i.type == pygame.QUIT:
            exit()

###############################

    pygame.draw.rect (win, color, head)
    keys = pygame.key.get_pressed
    pygame.display.update()
    move (head)

Ответы (1 шт):

Автор решения: Danis

вы не вызвали функцию

keys = pygame.key.get_pressed

замените на

keys = pygame.key.get_pressed()
→ Ссылка