本文整理汇总了Python中turtle.Turtle.goto方法的典型用法代码示例。如果您正苦于以下问题:Python Turtle.goto方法的具体用法?Python Turtle.goto怎么用?Python Turtle.goto使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类turtle.Turtle
的用法示例。
在下文中一共展示了Turtle.goto方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init_drawman
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import goto [as 别名]
def init_drawman():
global t, x_current, y_current
t=Turtle()
t.penup()
x_current = 0
y_current = 0
t.goto(x_current,y_current)
示例2: main
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import goto [as 别名]
def main():
p = Turtle()
p.color("green")
p.pensize(3)
#p.setundobuffer(None)
p.hideturtle() #Make the turtle invisible. It’s a good idea to do this while you’re in the middle of doing some complex drawing,
#because hiding the turtle speeds up the drawing observably.
#p.speed(10)
# p.getscreen().tracer(1,0)#Return the TurtleScreen object the turtle is drawing on.
p.speed(10)
#TurtleScreen methods can then be called for that object.
p.left(90)# Turn turtle left by angle units. direction 调整画笔
p.penup() #Pull the pen up – no drawing when moving.
p.goto(0, -80)#Move turtle to an absolute position. If the pen is down, draw line. Do not change the turtle’s orientation.
p.pendown()# Pull the pen down – drawing when moving. 这三条语句是一个组合相当于先把笔收起来再移动到指定位置,再把笔放下开始画
#否则turtle一移动就会自动的把线画出来
#t = tree([p], 200, 65, 0.6375)
t = tree([p], 200, 65, 0.6375)
p.penup() #Pull the pen up – no drawing when moving.
p.home()
p.goto(0, 80)
p.pendown()# P
p.right(90);
t1 = tree([p], 200, 65, 0.6375)
示例3: init
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import goto [as 别名]
def init():
global TTiles, STiles, designer
screen.mode("logo")
screen.tracer(False)
designer = Turtle(visible=False)
designer.pu()
makerhomboidshapes()
screen.bgcolor("gray10")
STiles = [TStein(A/20., clickable=False),
TStein(A/20., clickable=False),
TStein(2*d/20., clickable=False),
TStein(A/40., clickable=False),
TStein(A/40., clickable=False),
TStein(d/20., "square", clickable=False),
TRhomboid(clickable=False)]
TTiles = [TStein(A/20.),
TStein(A/20.),
TStein(2*d/20.),
TStein(A/40.),
TStein(A/40.),
TStein(d/20., "square"),
TRhomboid()]
for s in STiles:
s.color((1,1,0.9))
s.turtlesize(s.size, s.size, 2)
s.ht()
screen.update()
designer.goto(-390,-288)
designer.pencolor("gray70")
designer.write("Inspired by Pavel Boytchev's Elica-Logo implementation of the tangram game",
font=("Courier", 10, "bold"))
nextBtn = Button("next.gif", resetgame)
nextBtn.setpos(320,220)
helpBtn = Button("help.gif", helpme)
helpBtn.setpos(320,-220)
示例4: init_drawman
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import goto [as 别名]
def init_drawman():
global x_current, y_current, t, _drawman_scale
t=Turtle()
t.penup()
x_current=0
y_current=0
t.goto(x_current,y_current)
drawman_scale(default_scale) # функция задает масштаб по умолчанию
示例5: init_drawman
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import goto [as 别名]
def init_drawman():
global t, x_current, y_current, _drawman_scale
t=Turtle()
t.penup()
x_current = 0
y_current = 0
t.goto(x_current, y_current)
drawman_scale(default_scale)
示例6: draw_line
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import goto [as 别名]
def draw_line(t: Turtle, start, end,*,
color="white", size=1):
t.pensize(size)
t.pencolor(color)
t.penup()
t.goto(*start)
t.pendown()
t.goto(*end)
示例7: init_drawman
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import goto [as 别名]
def init_drawman():
global t, x_current, y_current, _drawman_scale
t=Turtle()
t.speed(100)
t.penup()
x_current = 0
y_current = 0
t.goto(x_current, y_current)
_drawman_scale = 10
示例8: init_drawman
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import goto [as 别名]
def init_drawman():
""" Инициализация черепашки """
global t, x_current, y_current, _drawman_scale
t = Turtle()
t.penup()
x_current = 0
y_current = 0
t.goto(x_current, y_current)
drawman_scale(default_scale)
示例9: init_drawman
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import goto [as 别名]
def init_drawman():
global t, x_current, y_current, _drawman_scale, dx, dy
t = Turtle()
t.penup()
x_current = 0
y_current = 0
dx = t.screen.window_width()/2
dy = t.screen.window_height()/2
t.goto(x_current, y_current)
drawman_scale(default_scale)
示例10: init_drawman
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import goto [as 别名]
def init_drawman():
global t, x_current, y_current, _drawman_scale, _step_grid, _count_point
t = Turtle()
t.penup()
x_current = 0
y_current = 0
t.goto(x_current, y_current)
_count_point = default_count_point
_step_grid = default_step_grid
drawman_scale(default_scale,default_step_grid)
示例11: maketree
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import goto [as 别名]
def maketree(x):
p = Turtle(shape="triangle", visible=False)
p.setundobuffer(None)
p.fillcolor("green")
p.shapesize(0.4)
p.speed(0)
p.left(90)
p.penup()
p.goto(x, -110)
p.pendown()
return tree([p], 140, 65, 0.6375)
示例12: init_drawman
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import goto [as 别名]
def init_drawman():
''' Инициализация черепашки '''
global t, x_current, y_current, _drawman_scale
shag=40
vod=0.5
t = Turtle()
t.penup()
x_current = 0
y_current = 0
t.goto(x_current, y_current)
drawman_scale(shag,vod)
示例13: init_drawman
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import goto [as 别名]
def init_drawman():
""" Инициализация Чертежника"""
global t, x_current, y_current, _drawman_scale, _drawman_pen_size
t = Turtle()
t.penup()
shag = 40
vod = 0.5
x_current = 0
y_current = 0
t.goto(x_current, y_current)
drawman_scale(default_scale, shag, vod)
drawman_pen_size(default_pen_size)
示例14: maketree
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import goto [as 别名]
def maketree(x, y):
p = Turtle()
p.color("green")
p.pensize(5)
p.hideturtle()
#p.getscreen().tracer(30)
p.speed(10)
p.left(90)
p.penup()
p.goto(x, y)
p.pendown()
t = tree([p], 110, 65, 0.6375)
示例15: init_drawman
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import goto [as 别名]
def init_drawman():
global t,xc,yc
t = Turtle()
t.penup()
xc = 0
yc = 0
t.goto(xc,yc)
t.speed(100)
t.hideturtle()
drawman_color(default_color)
drawman_scale(default_scale)
drawman_width(default_width)