Python turtle.pencolor() Examples

The following are 2 code examples of turtle.pencolor(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module turtle , or try the search function .
Example #1
Source File: Palestine_en.py    From pythonCodes with MIT License 5 votes vote down vote up
def writetext(text,color,x,y):
   for i in range(1,10):
      turtle.penup()
      turtle.setx(x)
      turtle.sety(y)
      turtle.pendown
   
   turtle.pencolor(color)
   turtle.write(text,move=True, font=("Arial",16,"normal")) 
Example #2
Source File: xzpq.py    From You-are-Pythonista with GNU General Public License v3.0 4 votes vote down vote up
def norse():
    '''
    鼻子
    '''
    t.pu()  # 提笔
    t.goto(-100, 100)  # 画笔前往坐标(-100,100)
    t.pd()  # 下笔
    t.seth(-30)  # 笔的角度为-30°
    t.begin_fill()  # 外形填充的开始标志
    a = 0.4
    for i in range(120):
        if 0 <= i < 30 or 60 <= i < 90:
            a = a + 0.08
            t.lt(3)  # 向左转3度
            t.fd(a)  # 向前走a的步长
        else:
            a = a - 0.08
            t.lt(3)
            t.fd(a)
    t.end_fill()  # 依据轮廓填充
    t.pu()  # 提笔
    t.seth(90)  # 笔的角度为90度
    t.fd(25)  # 向前移动25
    t.seth(0)  # 转换画笔的角度为0
    t.fd(10)
    t.pd()
    t.pencolor(255, 155, 192)  # 设置画笔颜色
    t.seth(10)
    t.begin_fill()
    t.circle(5)  # 画一个半径为5的圆
    t.color(160, 82, 45)  # 设置画笔和填充颜色
    t.end_fill()
    t.pu()
    t.seth(0)
    t.fd(20)
    t.pd()
    t.pencolor(255, 155, 192)
    t.seth(10)
    t.begin_fill()
    t.circle(5)
    t.color(160, 82, 45)
    t.end_fill()