Pygame“TypeError:必须是2项序列,而不是builtin_function_or_method”

时间:2017-07-17 05:40:29

标签: python pygame typeerror

我想运行代码打开可以通过拖动鼠标绘制的Pygame屏幕。但IDLE总是说:

Traceback (most recent call last):
  File "D:/Python32/Pygame/draw", line 36, in <module>
    pygame.draw.circle(screen,WHITE,spot,radius)
TypeError: must be 2-item sequence, not builtin_function_or_method
    import pygame
    pygame.init()

    screen=pygame.display.set_mode([800,600])
    pygame.display.set_caption("Draw lines")



    WHITE=(225,225,225)
    radius=10

    mousedown=False



    keep_going=True
    while keep_going:



       for event in pygame.event.get():

            if event.type==pygame.QUIT:
                keep_going=False

            if event.type==pygame.MOUSEBUTTONDOWN:
                mousedown=True
            if event.type==pygame.MOUSEBUTTONUP:
                        mousedown=False



        if mousedown:
            spot=pygame.mouse.get_pos

                pygame.draw.circle(screen,WHITE,spot,radius)
             pygame.display.update()



    pygame.quit()

1 个答案:

答案 0 :(得分:2)

你缺少调用函数()的{​​{1}},因此Python将函数作为对象而不是函数的结果,这就是你得到这个错误的原因。

get_pos()