用Turtle绘制基本二部图:类型错误?

2024-09-28 01:26:58 发布

您现在位置:Python中文网/ 问答频道 /正文

我得到了这个错误: TypeError:setx()缺少1个必需的位置参数:“x”

当我尝试在Python中运行此代码时:

import turtle
myScreen = turtle.Screen()
myScreen.setup(0.5,0.75,0,0)
t = turtle.Turtle
coord_list_1 = [[-200,200],[-200,90],[-50,-20]]
coord_list_2 = [[50,200],[50,170],[300,90],[50,30],[50,0],[50,-13],[50,-73]]
def drawBipartiteGraph(inputList,inputList2):
    for m in range(0,len(inputList)):
        for n in range(0,len(inputList2)):
            t.setx(inputList[m][0])
            t.sety(inputList[m][1])
            t.pd()
            t.goto(inputList2[n][0],inputList2[n][1])
            t.goto(inputList[m][0],inputList[m][1])
            t.pu()
drawBipartiteGraph(coord_list_1,coord_list_2)

这可能是个愚蠢的问题,但我似乎不明白为什么它会输出那个错误。我写代码的方式有问题吗?在

谢谢!在


Tags: 代码inforlen错误rangelistturtle

热门问题