本文整理汇总了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!'
示例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()
示例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()
示例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()