2

3 次および 2 次グラフを「スケッチ」する pygame プログラムを作成しようとしています。私のコードは以下です。しかし、コードを実行しようとするたびに、このエラーが発生します。

y = 250 - ((A(x)**B)+(C(x)**D)+(E(x))+c)
TypeError: 'int' object is not callable

それが何を意味するのか、それを解決する方法がよくわかりません。

すべてのコードを投稿するのが面倒なら申し訳ありませんが、コードに他の問題があるかどうかを確認する必要がありました

import pygame,sys,time,random
A =1
B =2
C =5
D =1
E =7
c =5
line = (0,0,0)
x = 0.0
screen = pygame.display.set_mode((500,500))
screen.fill((255,255,255))
draw = True
start = True
count = 0
while start:
    pygame.draw.line(screen,(0,0,0),(250,0),(250,500))
    pygame.draw.line(screen,(0,0,0),(0,250),(500,250))
    while x <=500:
        y = 250 - ((A(x)**B)+(C(x)**D)+(E(x))+c)
        pos = (((x)+250),y)
        pygame.draw.line(screen,(line),(pos),(pos))
        pygame.display.update()
        x +=1
       for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit();sys.quit();

        again = raw_input('again? y/n')
        if again == 'y' or again == 'yes':
            start = True
            screen.fill(255,255,255)
            x = 0.0
        elif again == 'n' or again == 'no':
            start = False
4

1 に答える 1