Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 不同的填充和边界使用海龟_Python_Python 2.7_Turtle Graphics - Fatal编程技术网

Python 不同的填充和边界使用海龟

Python 不同的填充和边界使用海龟,python,python-2.7,turtle-graphics,Python,Python 2.7,Turtle Graphics,我有一个生成窗口的函数: import turtle t=turtle.Pen() def drawindow(dis): t.down() t.seth(0) drawshape(4, 15) t.up() t.fd(7.5) t.seth(90) t.down() t.fd(15) t.up() t.seth(180) t.fd(7.5) t.seth(270) t.fd(

我有一个生成窗口的函数:

import turtle
t=turtle.Pen()       

def drawindow(dis):
    t.down()
    t.seth(0)
    drawshape(4, 15)
    t.up()
    t.fd(7.5)
    t.seth(90)
    t.down()
    t.fd(15)
    t.up()
    t.seth(180)
    t.fd(7.5)
    t.seth(270)
    t.fd(7.5)
    t.seth(0)
    t.down()
    t.fd(15)
    t.end_fill()
我希望钢笔的颜色是黑色,但填充物是另一种颜色。我已经定义了一个函数
drawhouse()
,其中包括这个函数,在此之前,笔的颜色设置为黑色,填充开始。我试着做了
t.begin\u fill('blue')
,但这不起作用。请帮忙


drawshape(x,y)
绘制一个有x条边的多边形,每条边的长度为y。

开始绘制之前,请尝试调用

t.color('black', 'blue')
这将填充颜色设置为蓝色,线条颜色设置为黑色

或者,你也可以打电话

t.pencolor('black')
t.fillcolor('blue')

如果您愿意的话,可以单独选择。查看

上的文档非常感谢,很好。一个非常简单易懂的答案-谢谢