當前位置: 首頁>>代碼示例>>Python>>正文


Python turtle.pendown方法代碼示例

本文整理匯總了Python中turtle.pendown方法的典型用法代碼示例。如果您正苦於以下問題:Python turtle.pendown方法的具體用法?Python turtle.pendown怎麽用?Python turtle.pendown使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在turtle的用法示例。


在下文中一共展示了turtle.pendown方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: item

# 需要導入模塊: import turtle [as 別名]
# 或者: from turtle import pendown [as 別名]
def item(lenght, level, color):
    if level <= 0:
        return
    
    for _ in range(5):    # 5
        turtle.color(colors[color])
        turtle.forward(lenght)
        
        item(lenght/4, level-1, color+1)
        
        turtle.penup() # there is no need to draw again the same line  (and it can use differnt color)
        turtle.backward(lenght)
        turtle.pendown()
        
        turtle.right(360/8) # 8
    
    turtle.right(360/8 * 3) # 3 = 8 - 5 
開發者ID:furas,項目名稱:python-examples,代碼行數:19,代碼來源:main-colors-asymmetrical.py

示例2: Bezier_3

# 需要導入模塊: import turtle [as 別名]
# 或者: from turtle import pendown [as 別名]
def Bezier_3(x1, y1, x2, y2, x3, y3, x4, y4):  # 三階貝塞爾函數
    x1 = -Width / 2 + x1
    y1 = Height / 2 - y1
    x2 = -Width / 2 + x2
    y2 = Height / 2 - y2
    x3 = -Width / 2 + x3
    y3 = Height / 2 - y3
    x4 = -Width / 2 + x4
    y4 = Height / 2 - y4  # 坐標變換
    te.goto(x1, y1)
    te.pendown()
    for t in range(0, WriteStep + 1):
        x = Bezier(Bezier(Bezier(x1, x2, t / WriteStep), Bezier(x2, x3, t / WriteStep), t / WriteStep),
                   Bezier(Bezier(x2, x3, t / WriteStep), Bezier(x3, x4, t / WriteStep), t / WriteStep), t / WriteStep)
        y = Bezier(Bezier(Bezier(y1, y2, t / WriteStep), Bezier(y2, y3, t / WriteStep), t / WriteStep),
                   Bezier(Bezier(y2, y3, t / WriteStep), Bezier(y3, y4, t / WriteStep), t / WriteStep), t / WriteStep)
        te.goto(x, y)
    te.penup() 
開發者ID:tfx2001,項目名稱:python-turtle-draw-svg,代碼行數:20,代碼來源:main.py

示例3: writetext

# 需要導入模塊: import turtle [as 別名]
# 或者: from turtle import pendown [as 別名]
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")) 
開發者ID:remon,項目名稱:pythonCodes,代碼行數:11,代碼來源:Palestine_en.py

示例4: Bezier_2

# 需要導入模塊: import turtle [as 別名]
# 或者: from turtle import pendown [as 別名]
def Bezier_2(x1, y1, x2, y2, x3, y3):  # 二階貝塞爾函數
    te.goto(x1, y1)
    te.pendown()
    for t in range(0, WriteStep + 1):
        x = Bezier(Bezier(x1, x2, t / WriteStep),
                   Bezier(x2, x3, t / WriteStep), t / WriteStep)
        y = Bezier(Bezier(y1, y2, t / WriteStep),
                   Bezier(y2, y3, t / WriteStep), t / WriteStep)
        te.goto(x, y)
    te.penup() 
開發者ID:tfx2001,項目名稱:python-turtle-draw-svg,代碼行數:12,代碼來源:main.py

示例5: Moveto

# 需要導入模塊: import turtle [as 別名]
# 或者: from turtle import pendown [as 別名]
def Moveto(x, y):  # 移動到svg坐標下(x,y)
    te.penup()
    te.goto(-Width / 2 + x, Height / 2 - y)
    te.pendown() 
開發者ID:tfx2001,項目名稱:python-turtle-draw-svg,代碼行數:6,代碼來源:main.py

示例6: Moveto_r

# 需要導入模塊: import turtle [as 別名]
# 或者: from turtle import pendown [as 別名]
def Moveto_r(dx, dy):
    te.penup()
    te.goto(te.xcor() + dx, te.ycor() - dy)
    te.pendown() 
開發者ID:tfx2001,項目名稱:python-turtle-draw-svg,代碼行數:6,代碼來源:main.py

示例7: line

# 需要導入模塊: import turtle [as 別名]
# 或者: from turtle import pendown [as 別名]
def line(x1, y1, x2, y2):  # 連接svg坐標下兩點
    te.penup()
    te.goto(-Width / 2 + x1, Height / 2 - y1)
    te.pendown()
    te.goto(-Width / 2 + x2, Height / 2 - y2)
    te.penup() 
開發者ID:tfx2001,項目名稱:python-turtle-draw-svg,代碼行數:8,代碼來源:main.py

示例8: Lineto

# 需要導入模塊: import turtle [as 別名]
# 或者: from turtle import pendown [as 別名]
def Lineto(x, y):  # 連接當前點和svg坐標下(x,y)
    te.pendown()
    te.goto(-Width / 2 + x, Height / 2 - y)
    te.penup() 
開發者ID:tfx2001,項目名稱:python-turtle-draw-svg,代碼行數:6,代碼來源:main.py

示例9: move

# 需要導入模塊: import turtle [as 別名]
# 或者: from turtle import pendown [as 別名]
def move(distance):
	turtle.penup()
	turtle.forward(distance)
	turtle.pendown() 
開發者ID:CharlesPikachu,項目名稱:Tools,代碼行數:6,代碼來源:clock.py

示例10: draw_snowflake

# 需要導入模塊: import turtle [as 別名]
# 或者: from turtle import pendown [as 別名]
def draw_snowflake(size):
    """ Draw a picture of a snowflake """
    turtle.penup()
    turtle.forward(10 * size)
    turtle.left(45)
    turtle.pendown()
    turtle.color(generate_random_colour())

    # draw branch 8 times to make a snowflake
    for _ in range(8):
        draw_branch(size)
        turtle.forward(size)
        turtle.left(45)

    turtle.penup() 
開發者ID:johnehunt,項目名稱:advancedpython3,代碼行數:17,代碼來源:snowflake.py

示例11: draw_circle

# 需要導入模塊: import turtle [as 別名]
# 或者: from turtle import pendown [as 別名]
def draw_circle(x, y, radius, red=50, green=255, blue=10, width=7):
    """ Draw a circle at a specific x, y location.
    Then draw four smaller circles recursively"""
    colour = (red, green, blue)

    # Recursively drawn smaller circles
    if radius > 50:
        # Calculate colours and line width for smaller circles
        if red < 216:
            red = red + 33
            green = green - 42
            blue = blue + 10
            width -= 1
        else:
            red = 0
            green = 255
        # Calculate the radius for the smaller circles
        new_radius = int(radius / 1.3)
        # Drawn four circles
        draw_circle(int(x + new_radius), y, new_radius, red, green, blue, width)
        draw_circle(x - new_radius, y, new_radius, red, green, blue, width)
        draw_circle(x, int(y + new_radius), new_radius, red, green, blue, width)
        draw_circle(x, int(y - new_radius), new_radius, red, green, blue, width)

    # Draw the original circle
    turtle.goto(x, y)
    turtle.color(colour)
    turtle.width(width)
    turtle.pendown()
    turtle.circle(radius)
    turtle.penup()


# Run the program 
開發者ID:johnehunt,項目名稱:advancedpython3,代碼行數:36,代碼來源:circles-picture.py

示例12: arc

# 需要導入模塊: import turtle [as 別名]
# 或者: from turtle import pendown [as 別名]
def arc(sa, ea, x, y, r):  # start angle,end angle,circle center,radius
    turtle.penup()
    turtle.goto(x, y)
    turtle.setheading(0)
    turtle.left(sa)
    turtle.fd(r)
    turtle.pendown()
    turtle.left(90)
    turtle.circle(r, (ea - sa))
    return turtle.position() 
開發者ID:MiracleYoung,項目名稱:You-are-Pythonista,代碼行數:12,代碼來源:bqb.py

示例13: item

# 需要導入模塊: import turtle [as 別名]
# 或者: from turtle import pendown [as 別名]
def item(lenght, level, color):
    if level <= 0:
        return
    
    for _ in range(8):
        turtle.color(colors[color])
        turtle.forward(lenght)
        
        item(lenght/4, level-1, color+1)
        
        turtle.penup() # there is no need to draw again the same line (and it can use differnt color)
        turtle.backward(lenght)
        turtle.pendown()
        
        turtle.right(360/8) 
開發者ID:furas,項目名稱:python-examples,代碼行數:17,代碼來源:main-colors.py

示例14: lineto

# 需要導入模塊: import turtle [as 別名]
# 或者: from turtle import pendown [as 別名]
def lineto(dx, dy):  # 連接當前點和相對坐標(dx,dy)的點
    te.pendown()
    te.goto(te.xcor() + dx, te.ycor() - dy)
    te.penup() 
開發者ID:Seraphir,項目名稱:turtle-vectorgraph,代碼行數:6,代碼來源:homura.py

示例15: horizontal

# 需要導入模塊: import turtle [as 別名]
# 或者: from turtle import pendown [as 別名]
def horizontal(dx):  # 做到相對橫坐標為dx的水平線
    te.seth(0)
    te.pendown()
    te.fd(dx)
    te.penup() 
開發者ID:Seraphir,項目名稱:turtle-vectorgraph,代碼行數:7,代碼來源:homura.py


注:本文中的turtle.pendown方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。