本文整理汇总了Python中turtle.Turtle.pu方法的典型用法代码示例。如果您正苦于以下问题:Python Turtle.pu方法的具体用法?Python Turtle.pu怎么用?Python Turtle.pu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类turtle.Turtle
的用法示例。
在下文中一共展示了Turtle.pu方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import pu [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)
示例2: main
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import pu [as 别名]
def main():
global s, t
s = Screen()
s.bgcolor("gray10")
t = Turtle(visible=False, shape="square")
t.pu()
t.speed(0)
s.tracer(False)
ta = clock()
recsquare(256, 0.5, colors)
tb = clock()
return "{0:.2f}sec.".format(tb-ta)
示例3: main
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import pu [as 别名]
def main():
## create compound yellow/blue turtleshape for planets
global s
s = Screen()
s.setup(1120,840)
s.reset()
s.tracer(0, 0)
t = Turtle()
t.ht()
t.pu()
t.fd(6)
t.lt(90)
t.begin_poly()
t.circle(6, 180)
t.end_poly()
m1 = t.get_poly()
t.begin_poly()
t.circle(6,180)
t.end_poly()
m2 = t.get_poly()
planetshape = Shape("compound")
planetshape.addcomponent(m1,"orange")
planetshape.addcomponent(m2,"blue")
s.register_shape("planet", planetshape)
#s.tracer(1,0)
s.update()
## setup gravitational system
gs = GravSys()
sun = Star(1000000, Vec(-250,0), Vec(0,-0.35), gs, "circle")
sun.color("yellow")
sun.pensize(1.8)
sun.pu()
earth = Star(5000, Vec(450,0), Vec(0,70), gs, "planet")
earth.pencolor("green")
earth.shapesize(0.8)
rm=12.0583
vm=(8.0*5000/rm)**.5
moon = Star(1, Vec(450+rm,0), Vec(0,70+vm), gs, "planet")
moon.pencolor("blue")
moon.shapesize(0.5)
gs.init()
gs.start()
return "Done!"
示例4: main
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import pu [as 别名]
def main():
global screen, red, green, blue
screen = Screen()
screen.delay(0)
screen.setworldcoordinates(-1, -0.3, 3, 1.3)
red = ColorTurtle(0, .5)
green = ColorTurtle(1, .5)
blue = ColorTurtle(2, .5)
setbgcolor()
writer = Turtle()
writer.ht()
writer.pu()
writer.goto(1,1.15)
writer.write("DRAG!",align="center",font=("Arial",30,("bold","italic")))
return "EVENTLOOP"
示例5: createPlanetShape
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import pu [as 别名]
def createPlanetShape():
s.tracer(0,0)
t = Turtle()
t.ht()
t.pu()
t.fd(6)
t.lt(90)
t.begin_poly()
t.circle(6, 180)
t.end_poly()
m1 = t.get_poly()
t.begin_poly()
t.circle(6,180)
t.end_poly()
m2 = t.get_poly()
planetshape = Shape("compound")
planetshape.addcomponent(m1,"orange")
planetshape.addcomponent(m2,"blue")
s.register_shape("planet", planetshape)
s.tracer(True,0)
示例6: main
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import pu [as 别名]
def main():
s = Turtle()
s.reset()
s.getscreen().tracer(0,0)
s.ht()
s.pu()
s.fd(6)
s.lt(90)
s.begin_poly()
s.circle(6, 180)
s.end_poly()
m1 = s.get_poly()
s.begin_poly()
s.circle(6,180)
s.end_poly()
m2 = s.get_poly()
planetshape = Shape("compound")
planetshape.addcomponent(m1,"orange")
planetshape.addcomponent(m2,"blue")
s.getscreen().register_shape("planet", planetshape)
s.getscreen().tracer(1,0)
## setup gravitational system
gs = GravSys()
sun = Star(1000000, Vec(0,0), Vec(0,-2.5), gs, "circle")
sun.color("yellow")
sun.shapesize(1.8)
sun.pu()
earth = Star(12500, Vec(210,0), Vec(0,195), gs, "planet")
earth.pencolor("green")
earth.shapesize(0.8)
moon = Star(1, Vec(220,0), Vec(0,295), gs, "planet")
moon.pencolor("blue")
moon.shapesize(0.5)
gs.init()
gs.start()
return "Done!"
示例7: Screen
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import pu [as 别名]
Use left mouse button to drag, middle
and right mouse button clicks to turn tiles,
left button doubleclick to flip rhomboid.
"""
from turtle import Turtle, Screen, Vec2D
from button import Button
import sys, random, time
from tangramdata import tangramdata
sys.setrecursionlimit(20000)
screen = Screen()
screen.tracer(False)
screen.mode("logo")
designer = Turtle(visible=False)
designer.pu()
startdata = tangramdata[0]
tangramdata = tangramdata[1:]
A = 198.0
a = A / 4.0
d = a * 2**.5
def makerhomboidshapes():
designer.shape("square")
designer.shapesize(5, 2.5)
designer.shearfactor(-1) # needs Python 3.1
designer.tilt(90)
screen.register_shape("rhomboid1", designer.get_shapepoly())
designer.shearfactor(1)
screen.register_shape("rhomboid2", designer.get_shapepoly())