当前位置: 首页>>代码示例>>Python>>正文


Python Turtle.width方法代码示例

本文整理汇总了Python中turtle.Turtle.width方法的典型用法代码示例。如果您正苦于以下问题:Python Turtle.width方法的具体用法?Python Turtle.width怎么用?Python Turtle.width使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在turtle.Turtle的用法示例。


在下文中一共展示了Turtle.width方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import width [as 别名]
def main():
        t = Turtle()
        # prompt the user for the number of steps
        iterations = input("Enter the number of reps: ")
        t.pencolor("red")
        t.screen.bgcolor("blue")
        t.width(10)

        # run the walk with the parameters specified
        # this walk starts at the origin (centre of the window) every time
        randomWalkRandomColours(t, 0, 0, iterations)
        t.hideturtle()

        print '\n\nProgram Done!'
开发者ID:emarteca,项目名称:TurtleWalk,代码行数:16,代码来源:randomWalk_randomColours.py

示例2: Turtle

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import width [as 别名]
# Turtle Docs: https://docs.python.org/2.7/library/turtle.html
from turtle import Turtle, Screen

# Create two objects: a Turtle with the name cursor and a Screen called window
cursor = Turtle()
window = Screen()

# Set the window background color to black
window.bgcolor("black")

# Make the cursor ink white, the width of the pen 3, the shape a turtle, and 
# move at moderate speed
cursor.color("white")
cursor.width(3)
cursor.shape("turtle") # or "circle", "classic", etc.
cursor.speed(5) # 1 - 10


# Draw a square of side length 100 starting from the home position
cursor.home()
for i in range(4):
	print cursor.position()
	cursor.forward(100)
	cursor.right(90)
print cursor.position()

# Move the turtle to (0, 100) without drawing anything,
# then draw a pentagon
cursor.penup()
cursor.sety(100)
print cursor.position()
开发者ID:WheatonWHALE,项目名称:comp115,代码行数:33,代码来源:15_turtle_examples.py

示例3: create_turtles

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import width [as 别名]
def create_turtles(ne):
    for i in range(ne):
        t = Turtle()
        t.ht()
        t.speed(0)
        t.seth(i * 360.0 / ne)
        t.width(3)
    return s.turtles()
开发者ID:DestinyHe,项目名称:python-turtle-demo,代码行数:10,代码来源:tdemo_wikipedia3.py

示例4: main

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import width [as 别名]
def main():
    t = Turtle()
    my_win = Screen()
    t.width(12)
    t.speed(10)
    t.left(90)
    t.up()
    t.backward(100)
    t.down()
    t.color("brown")
    tree(75, t)
    my_win.exitonclick()
开发者ID:praetore,项目名称:python-data-structures-and-algorithms,代码行数:14,代码来源:turtletree.py


注:本文中的turtle.Turtle.width方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。