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


Python Turtle.goto方法代码示例

本文整理汇总了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)
开发者ID:Elodia-Elwen,项目名称:kpk2016,代码行数:9,代码来源:drawman.py

示例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)
开发者ID:allensdz,项目名称:python,代码行数:28,代码来源:DrawTree.py

示例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)
开发者ID:DestinyHe,项目名称:python-turtle-demo,代码行数:37,代码来源:tdemo_tangram.py

示例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) # функция задает масштаб по умолчанию
开发者ID:BudykinaSV,项目名称:KPK_2016,代码行数:10,代码来源:proba.py

示例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)
开发者ID:tuhbatshina,项目名称:kpk_Python,代码行数:10,代码来源:Drawman.py

示例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)
开发者ID:a1ip,项目名称:my_check,代码行数:10,代码来源:main.py

示例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
开发者ID:MolchanovaIA,项目名称:kpk,代码行数:11,代码来源:drawman.py

示例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)
开发者ID:Viktor-S26,项目名称:OPKU2016,代码行数:11,代码来源:task_dm3.py

示例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)
开发者ID:korobitzyna,项目名称:kpk2016,代码行数:12,代码来源:drawman.py

示例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)
开发者ID:Tavisevik,项目名称:kpk-python,代码行数:12,代码来源:drawman.py

示例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)
开发者ID:1c71,项目名称:Program-Practice,代码行数:13,代码来源:tdemo_2rtrees_generators.py

示例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)
开发者ID:savvich,项目名称:kpk2016,代码行数:13,代码来源:drawman.py

示例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)
开发者ID:temo4kin,项目名称:kpk2016,代码行数:14,代码来源:drawman.py

示例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)
开发者ID:944624574ws,项目名称:python,代码行数:14,代码来源:tree.py

示例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)
开发者ID:alexcigun,项目名称:python0716,代码行数:14,代码来源:drawman.py


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