0
내 클래스의 인스턴스를 만들 때 파일이로드되지 않는 이유를 이해하려고합니다. 나는 같은 디렉토리에 파일 cartizzle.png을 넣어 가지고하지만 난라는 오류가 계속 : 오류 : 당신은 '동안 진정한'추첨에() 함수를 의도한다파이 게임에 이미지 업로드에 문제가 발생했습니다.
class Picture():
def __init__(self, location, filename):
self.x = location[0]
self.y = location[1]
self.filename = filename
def draw(self):
pygame.init()
surface_sz = 500
main_surface = pygame.display.set_mode((surface_sz, surface_sz))
while True:
ev = pygame.event.poll()
if ev.type == pygame.QUIT:
break
elif ev.type == pygame.KEYDOWN and ev.key == pygame.K_q:
break
main_surface.fill((0,200,255))
main_surface.blit(self.filename, (self.x, self.y))
pygame.display.flip()
pygame.quit()
pic_inst = Picture((150,200), pygame.image.load("cartizzle.png"))
pic_inst.draw()