pygame太少或太多的论点

时间:2018-02-17 02:04:46

标签: python python-2.7 pygame

每当我尝试以下代码时,它都会给我这个

Traceback (most recent call last):
File "C:/Python27/test pygame", line 14, in <module>
pygame.draw.lines(screen, red, 100,100, 150,200, 1)
TypeError: function takes at most 5 arguments (7 given)

无论我改变什么,它都会给它或者它告诉我我太少了。

import pygame

red = (255,0,0)
green = (0,255,0)
blue = (0,0,255)
darkBlue = (0,0,128)
white = (255,255,255)
black = (0,0,0)
pink = (255,200,200)
background_colour = (255,255,255)
(width, height) = (1000, 1000)
screen = pygame.display.set_mode((width, height))
pygame.display.set_caption('Tutorial 1')
screen.fill(background_colour)
pygame.draw.lines(screen, red, 100,100, 150,200, 1)
pygame.display.flip()
running = True
while running:
  for event in pygame.event.get():
    if event.type == pygame.QUIT:
      running = False

有人可以告诉我如何解决它吗?

1 个答案:

答案 0 :(得分:0)

使用元组将参数分组为: [(100,100),(150,200)]

您可以参考:https://www.cs.ucsb.edu/~pconrad/cs5nm/topics/pygame/drawing/