python - Pygame. TypeError: 'pygame.Surface' object is not callable -


i new python, pygame, , coding in general.

i not know why code getting:

"typeerror: 'pygame.surface' object not callable"

and black screen.

here code:


import pygame ptypeerror: 'pygame.surface' object not callableygame.init  black = (0,0,0) white = (255,255,255) red = (255,0,0) green = (0,255,0) blue = (0,0,255)  char_sprite = pygame.image.load("man.png")  display_height = 800 display_width = 1000 dead = false framerate = 60  game_display = pygame.display.set_mode((display_width,display_height)) pygame.display.set_caption("tiny fighter") clock = pygame.time.clock()   def char(x,y):     game_dispaly.blit(char_sprite,(x,y))  x= display_width / 2 y= display_height / 2  while not dead:     event in pygame.event.get():         if event.type == pygame.quit:             dead = true      game_display.fill(green)      char_sprite(x,y)     pygame.display.update()     clock.tick(framerate)  pygame.quit() quit() 

full traceback:


traceback (most recent call last): file "/home/hayden/desktop/tiny fighter/tiny fighter.py", line 35, in char_sprite(x,y) typeerror: 'pygame.surface' object not callable


you have typo. spelled display wrong. also, misspelled method name; should char(x, y) not char_sprite(x, y).


Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -

python - pdfminer - import error -