[英]I keep getting the "TypeError: 'pygame.Surface' object is not callable" error every time I try to run this project
import pygame,sys
pygame.init()
screen = pygame.display.set_mode((1366, 720))
clock = pygame.time.Clock()
test_surface = pygame.Surface((100,200))
test_surface.fill(pygame.Color(0, 0, 255))
x_pos = 200
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
screen.fill((175,201,70))
x_pos += 1
screen.blit(test_surface(x_pos,500))
pygame.display.update()
clock.tick(60)
This is the code.这是代码。 I cannot find any way to fix this problem.我找不到任何方法来解决这个问题。 Any help on this would be appreciated.对此的任何帮助将不胜感激。
import pygame,sys
if __name__ == "__main__":
pygame.init()
screen = pygame.display.set_mode((1366, 720))
clock = pygame.time.Clock()
test_surface = pygame.Surface((100,200))
test_surface.fill(pygame.Color(0, 0, 255))
x_pos = 200
screen.fill((175,201,70))
x_pos += 1
screen.blit(test_surface, (x_pos,500))
pygame.display.update()
clock.tick(60)
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
you can use this code你可以使用这个代码
error was in screen.blit, first argument is surface, and second argument is coords错误在 screen.blit 中,第一个参数是表面,第二个参数是坐标
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.