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


Python Turtle.penup方法代码示例

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


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

示例1: __init__

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import penup [as 别名]
class TurtleDisplay:
    __start_point = None
    __scale = (2, -2)
    __offset = (-250, 250)
    
    def __init__(self):
        self.__turtle = Turtle()
    
    def add_point(self, point):
        x, y = self.translate(point)
        if self.__start_point:
            self.__turtle.goto(x, y)
        else:
#            self.__turtle.speed(0)
            self.__turtle.tracer(100)
            self.__start_point = point
            self.__turtle.penup()
            self.__turtle.goto(x, y)
            self.__turtle.pendown()

    def close_curve(self):
        x, y = self.translate(self.__start_point)
        self.__turtle.tracer(1)
        self.__turtle.goto(x, y)
        self.__start_point = None
        
    def close(self):
        print "Press enter to continue."
        raw_input()
    
    def translate(self, point):
        x, y = point
        xscale, yscale = self.__scale
        xoff, yoff = self.__offset
        return (xscale*x + xoff, yscale*y + yoff)
开发者ID:donkirkby,项目名称:donkirkby,代码行数:37,代码来源:turtle_display.py

示例2: init_drawman

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import penup [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

示例3: Lampe

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import penup [as 别名]
class Lampe():
	lyser = False
	turtle = None


	def lag_skilpadde(self):
		""" Lager en egen skilpadde for denne lamen."""
		self.turtle = Turtle()
		self.turtle.penup()
		self.turtle.hideturtle()

		# Gult lys når vi lyser.
		self.turtle.shape('circle')
		self.turtle.color('yellow')
		self.turtle.shapesize(5)



	def slaa_paa(self):
		self.lyser = True
		self.turtle.showturtle()


	def slaa_av(self):
		self.lyser = False
		self.turtle.hideturtle()
开发者ID:Arxcis,项目名称:Python-V2016,代码行数:28,代码来源:LysAvogpaa.py

示例4: setup

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import penup [as 别名]
def setup(color, distance):
    t = Turtle()
    t.pencolor(color)
    t.penup()
    t.forward(distance)
    t.pendown()
    return t
开发者ID:LJWilliams,项目名称:assets,代码行数:9,代码来源:flock-pursuit.py

示例5: main

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import penup [as 别名]
def main():
    screen.mode("logo")
    t = Turtle(shape="triangle")
    t.penup(); t.back(280); t.pendown()
    t.pensize(3)
    itree(t, 250, 0.63,
          ["black", "brown", "red", "orange", "violet", "lightblue"])
开发者ID:1c71,项目名称:Program-Practice,代码行数:9,代码来源:tdemo_itree.py

示例6: draw_table

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import penup [as 别名]
def draw_table(dimension: int, side: int, turtle: Turtle, x_coord: int, y_coord: int) -> None:
    fill = False

    for i in range(dimension ** 2):
        if i % dimension == 0:
            y_coord -= side
            turtle.penup()
            turtle.setpos(x_coord, y_coord)
            turtle.pendown()
            fill = fill != (dimension % 2 == 0)

        if fill:
            turtle.begin_fill()

        for _ in range(4):
            turtle.forward(side)
            turtle.right(90)

        if turtle.filling():
            turtle.end_fill()

        turtle.forward(side)

        fill = not fill

    done()
开发者ID:wencakisa,项目名称:Softuni-Python3,代码行数:28,代码来源:chess.py

示例7: main

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import penup [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

示例8: draw_line

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import penup [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

示例9: init_drawman

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import penup [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

示例10: init_drawman

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import penup [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

示例11: init_drawman

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import penup [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

示例12: init_drawman

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import penup [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

示例13: init_drawman

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import penup [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

示例14: init_drawman

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import penup [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

示例15: maketree

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import penup [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


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