本文整理汇总了Python中turtle.penup方法的典型用法代码示例。如果您正苦于以下问题:Python turtle.penup方法的具体用法?Python turtle.penup怎么用?Python turtle.penup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在模块turtle的用法示例。
在下文中一共展示了turtle.penup方法的22个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: Bezier_3
点赞 6
# 需要导入模块: import turtle [as 别名]
# 或者: from turtle import penup [as 别名]
def Bezier_3(x1, y1, x2, y2, x3, y3, x4, y4): # 三阶贝塞尔函数
x1 = -Width / 2 + x1
y1 = Height / 2 – y1
x2 = -Width / 2 + x2
y2 = Height / 2 – y2
x3 = -Width / 2 + x3
y3 = Height / 2 – y3
x4 = -Width / 2 + x4
y4 = Height / 2 – y4 # 坐标变换
te.goto(x1, y1)
te.pendown()
for t in range(0, WriteStep + 1):
x = Bezier(Bezier(Bezier(x1, x2, t / WriteStep), Bezier(x2, x3, t / WriteStep), t / WriteStep),
Bezier(Bezier(x2, x3, t / WriteStep), Bezier(x3, x4, t / WriteStep), t / WriteStep), t / WriteStep)
y = Bezier(Bezier(Bezier(y1, y2, t / WriteStep), Bezier(y2, y3, t / WriteStep), t / WriteStep),
Bezier(Bezier(y2, y3, t / WriteStep), Bezier(y3, y4, t / WriteStep), t / WriteStep), t / WriteStep)
te.goto(x, y)
te.penup()
开发者ID:tfx2001,项目名称:python-turtle-draw-svg,代码行数:20,
示例2: setup_screen
点赞 6
# 需要导入模块: import turtle [as 别名]
# 或者: from turtle import penup [as 别名]
def setup_screen(title, background=’white’, screen_size_x=640, screen_size_y=320, tracer_size=200):
print(‘Set up Screen’)
turtle.title(title)
turtle.setup(screen_size_x, screen_size_y)
turtle.hideturtle()
turtle.penup()
turtle.backward(240)
turtle.tracer(tracer_size)
turtle.bgcolor(background) # Set the background colour of the screen
开发者ID:johnehunt,项目名称:advancedpython3,代码行数:11,
示例3: __init__
点赞 6
# 需要导入模块: import turtle [as 别名]
# 或者: from turtle import penup [as 别名]
def __init__(
self,
screen_width = 800,
screen_height = 600,
background_color = “black”,
title = “Simple Game Library by /u/wynand1004 AKA @TokyoEdTech”,
splash_time = 3):
# Setup using Turtle module methods
turtle.setup(width=screen_width, height=screen_height)
turtle.bgcolor(background_color)
turtle.title(title)
turtle.tracer(0) # Stop automatic screen refresh
turtle.listen() # Listen for keyboard input
turtle.hideturtle() # Hides default turtle
turtle.penup() # Puts pen up for defaut turtle
turtle.setundobuffer(0) # Do not keep turtle history in memory
turtle.onscreenclick(self.click)
# Game Attributes
self.SCREEN_WIDTH = screen_width
self.SCREEN_HEIGHT = screen_height
self.DATAFILE = “game.dat”
self.SPLASHFILE = “splash.gif” # Must be in the same folder as game file
self.fps = 30.0 # Lower this on slower computers or with large number of sprites
self.title = title
self.gravity = 0
self.state = “showsplash”
self.splash_time = splash_time
self.time = time.time()
# Clear the terminal and print the game title
self.clear_terminal_screen()
print (self.title)
# Show splash
self.show_splash(self.splash_time)
# Pop ups
开发者ID:wynand1004,项目名称:SPGL,代码行数:43,
示例4: __init__
点赞 6
# 需要导入模块: import turtle [as 别名]
# 或者: from turtle import penup [as 别名]
def __init__(self,
text,
color,
x = 0,
y = 0,
font_name = “Arial”,
font_size = 12,
font_type = “normal”,
align = “left”):
turtle.Turtle.__init__(self)
self.hideturtle()
self.penup()
self.goto(x, y)
self.color(color)
self.font = (font_name, font_size, font_type)
self.align = align
# Attributes
self.text = text
# Append to master label list
Game.labels.append(self)
开发者ID:wynand1004,项目名称:SPGL,代码行数:26,
示例5: item
点赞 6
# 需要导入模块: import turtle [as 别名]
# 或者: from turtle import penup [as 别名]
def item(lenght, level, color):
if level <= 0:
return
for _ in range(5): # 5
turtle.color(colors[color])
turtle.forward(lenght)
item(lenght/4, level-1, color+1)
turtle.penup() # there is no need to draw again the same line (and it can use differnt color)
turtle.backward(lenght)
turtle.pendown()
turtle.right(360/8) # 8
turtle.right(360/8 * 3) # 3 = 8 – 5
开发者ID:furas,项目名称:python-examples,代码行数:19,
示例6: writetext
点赞 5
# 需要导入模块: import turtle [as 别名]
# 或者: from turtle import penup [as 别名]
def writetext(text,color,x,y):
for i in range(1,10):
turtle.penup()
turtle.setx(x)
turtle.sety(y)
turtle.pendown
turtle.pencolor(color)
turtle.write(text,move=True, font=(“Arial”,16,”normal”))
开发者ID:remon,项目名称:pythonCodes,代码行数:11,
示例7: Bezier_2
点赞 5
# 需要导入模块: import turtle [as 别名]
# 或者: from turtle import penup [as 别名]
def Bezier_2(x1, y1, x2, y2, x3, y3): # 二阶贝塞尔函数
te.goto(x1, y1)
te.pendown()
for t in range(0, WriteStep + 1):
x = Bezier(Bezier(x1, x2, t / WriteStep),
Bezier(x2, x3, t / WriteStep), t / WriteStep)
y = Bezier(Bezier(y1, y2, t / WriteStep),
Bezier(y2, y3, t / WriteStep), t / WriteStep)
te.goto(x, y)
te.penup()
开发者ID:tfx2001,项目名称:python-turtle-draw-svg,代码行数:12,
示例8: Moveto
点赞 5
# 需要导入模块: import turtle [as 别名]
# 或者: from turtle import penup [as 别名]
def Moveto(x, y): # 移动到svg坐标下(x,y)
te.penup()
te.goto(-Width / 2 + x, Height / 2 – y)
te.pendown()
开发者ID:tfx2001,项目名称:python-turtle-draw-svg,代码行数:6,
示例9: Moveto_r
点赞 5
# 需要导入模块: import turtle [as 别名]
# 或者: from turtle import penup [as 别名]
def Moveto_r(dx, dy):
te.penup()
te.goto(te.xcor() + dx, te.ycor() – dy)
te.pendown()
开发者ID:tfx2001,项目名称:python-turtle-draw-svg,代码行数:6,
示例10: line
点赞 5
# 需要导入模块: import turtle [as 别名]
# 或者: from turtle import penup [as 别名]
def line(x1, y1, x2, y2): # 连接svg坐标下两点
te.penup()
te.goto(-Width / 2 + x1, Height / 2 – y1)
te.pendown()
te.goto(-Width / 2 + x2, Height / 2 – y2)
te.penup()
开发者ID:tfx2001,项目名称:python-turtle-draw-svg,代码行数:8,
示例11: Lineto
点赞 5
# 需要导入模块: import turtle [as 别名]
# 或者: from turtle import penup [as 别名]
def Lineto(x, y): # 连接当前点和svg坐标下(x,y)
te.pendown()
te.goto(-Width / 2 + x, Height / 2 – y)
te.penup()
开发者ID:tfx2001,项目名称:python-turtle-draw-svg,代码行数:6,
示例12: Curveto
点赞 5
# 需要导入模块: import turtle [as 别名]
# 或者: from turtle import penup [as 别名]
def Curveto(x1, y1, x2, y2, x, y): # 三阶贝塞尔曲线到(x,y)
te.penup()
X_now = te.xcor() + Width / 2
Y_now = Height / 2 – te.ycor()
Bezier_3(X_now, Y_now, x1, y1, x2, y2, x, y)
global Xh
global Yh
Xh = x – x2
Yh = y – y2
开发者ID:tfx2001,项目名称:python-turtle-draw-svg,代码行数:11,
示例13: Curveto_r
点赞 5
# 需要导入模块: import turtle [as 别名]
# 或者: from turtle import penup [as 别名]
def Curveto_r(x1, y1, x2, y2, x, y): # 三阶贝塞尔曲线到相对坐标(x,y)
te.penup()
X_now = te.xcor() + Width / 2
Y_now = Height / 2 – te.ycor()
Bezier_3(X_now, Y_now, X_now + x1, Y_now + y1,
X_now + x2, Y_now + y2, X_now + x, Y_now + y)
global Xh
global Yh
Xh = x – x2
Yh = y – y2
开发者ID:tfx2001,项目名称:python-turtle-draw-svg,代码行数:12,
示例14: move
点赞 5
# 需要导入模块: import turtle [as 别名]
# 或者: from turtle import penup [as 别名]
def move(distance):
turtle.penup()
turtle.forward(distance)
turtle.pendown()
开发者ID:CharlesPikachu,项目名称:Tools,代码行数:6,
示例15: start
点赞 5
# 需要导入模块: import turtle [as 别名]
# 或者: from turtle import penup [as 别名]
def start():
# 不显示绘制时钟的过程
turtle.tracer(False)
turtle.mode(‘logo’)
createHand(‘second_hand’, 150)
createHand(‘minute_hand’, 125)
createHand(‘hour_hand’, 85)
# 秒, 分, 时
second_hand = turtle.Turtle()
second_hand.shape(‘second_hand’)
minute_hand = turtle.Turtle()
minute_hand.shape(‘minute_hand’)
hour_hand = turtle.Turtle()
hour_hand.shape(‘hour_hand’)
for hand in [second_hand, minute_hand, hour_hand]:
hand.shapesize(1, 1, 3)
hand.speed(0)
# 用于打印日期等文字
printer = turtle.Turtle()
printer.hideturtle()
printer.penup()
createClock(160)
# 开始显示轨迹
turtle.tracer(True)
startTick(second_hand, minute_hand, hour_hand, printer)
turtle.mainloop()
开发者ID:CharlesPikachu,项目名称:Tools,代码行数:28,
示例16: setup_screen
点赞 5
# 需要导入模块: import turtle [as 别名]
# 或者: from turtle import penup [as 别名]
def setup_screen(title, background=’white’, screen_size_x=640, screen_size_y=320, tracer_size=800):
print(‘Set up Screen’)
turtle.title(title)
turtle.setup(screen_size_x, screen_size_y)
turtle.hideturtle()
turtle.penup()
turtle.backward(240)
# Batch drawing to the screen for faster rendering
turtle.tracer(tracer_size)
turtle.bgcolor(background) # Set the background colour of the screen
开发者ID:johnehunt,项目名称:advancedpython3,代码行数:12,
示例17: setup_screen
点赞 5
# 需要导入模块: import turtle [as 别名]
# 或者: from turtle import penup [as 别名]
def setup_screen(title, background = ‘white’):
print(‘Set up Screen’)
turtle.title(title)
turtle.setup(640, 600)
turtle.hideturtle()
turtle.penup()
turtle.tracer(200)
turtle.bgcolor(background) # Set the background colour of the screen
开发者ID:johnehunt,项目名称:advancedpython3,代码行数:10,
示例18: draw_snowflake
点赞 5
# 需要导入模块: import turtle [as 别名]
# 或者: from turtle import penup [as 别名]
def draw_snowflake(size):
“”” Draw a picture of a snowflake “””
turtle.penup()
turtle.forward(10 * size)
turtle.left(45)
turtle.pendown()
turtle.color(generate_random_colour())
# draw branch 8 times to make a snowflake
for _ in range(8):
draw_branch(size)
turtle.forward(size)
turtle.left(45)
turtle.penup()
开发者ID:johnehunt,项目名称:advancedpython3,代码行数:17,
示例19: setup_screen
点赞 5
# 需要导入模块: import turtle [as 别名]
# 或者: from turtle import penup [as 别名]
def setup_screen(title, background=’white’, screen_size_x=640, screen_size_y=320, tracer_size=200):
“”” Sets up Turtle screen with useful defaults “””
print(‘Set up Screen’)
turtle.title(title)
turtle.setup(screen_size_x, screen_size_y)
turtle.hideturtle()
turtle.penup()
turtle.backward(240)
turtle.tracer(tracer_size)
turtle.bgcolor(background) # Set the background colour of the screen
开发者ID:johnehunt,项目名称:advancedpython3,代码行数:12,
示例20: arc
点赞 5
# 需要导入模块: import turtle [as 别名]
# 或者: from turtle import penup [as 别名]
def arc(sa, ea, x, y, r): # start angle,end angle,circle center,radius
turtle.penup()
turtle.goto(x, y)
turtle.setheading(0)
turtle.left(sa)
turtle.fd(r)
turtle.pendown()
turtle.left(90)
turtle.circle(r, (ea – sa))
return turtle.position()
开发者ID:MiracleYoung,项目名称:You-are-Pythonista,代码行数:12,
示例21: __init__
点赞 5
# 需要导入模块: import turtle [as 别名]
# 或者: from turtle import penup [as 别名]
def __init__(
self,
screen_width = 800,
screen_height = 600,
background_color = “black”,
title = “Simple Game Library by /u/wynand1004 AKA @TokyoEdTech”,
splash_time = 3):
# Setup using Turtle module methods
turtle.setup(width=screen_width, height=screen_height)
turtle.bgcolor(background_color)
turtle.title(title)
turtle.tracer(0) # Stop automatic screen refresh
turtle.listen() # Listen for keyboard input
turtle.hideturtle() # Hides default turtle
turtle.penup() # Puts pen up for defaut turtle
turtle.setundobuffer(0) # Do not keep turtle history in memory
turtle.onscreenclick(self.click)
# Game Attributes
self.FPS = 30.0 # Lower this on slower computers or with large number of sprites
self.SCREEN_WIDTH = screen_width
self.SCREEN_HEIGHT = screen_height
self.DATAFILE = “game.dat”
self.SPLASHFILE = “splash.gif” # Must be in the same folder as game file
self.title = title
self.gravity = 0
self.state = “showsplash”
self.splash_time = splash_time
self.time = time.time()
# Clear the terminal and print the game title
self.clear_terminal_screen()
print (self.title)
# Show splash
self.show_splash(self.splash_time)
# Pop ups
开发者ID:wynand1004,项目名称:Projects,代码行数:43,
示例22: item
点赞 5
# 需要导入模块: import turtle [as 别名]
# 或者: from turtle import penup [as 别名]
def item(lenght, level, color):
if level <= 0:
return
for _ in range(8):
turtle.color(colors[color])
turtle.forward(lenght)
item(lenght/4, level-1, color+1)
turtle.penup() # there is no need to draw again the same line (and it can use differnt color)
turtle.backward(lenght)
turtle.pendown()
turtle.right(360/8)
开发者ID:furas,项目名称:python-examples,代码行数:17,
注:本文中的turtle.penup方法示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。
今天的文章python中penup pendown_python兔子繁殖问题[通俗易懂]分享到此就结束了,感谢您的阅读。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/89132.html