本文整理汇总了Python中turtle.Screen类的典型用法代码示例。如果您正苦于以下问题:Python Screen类的具体用法?Python Screen怎么用?Python Screen使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Screen类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: main
def main():
swarmSize = 100
t = Turtle()
win = Screen()
win.setworldcoordinates(-600, -600, 600, 600)
t.speed(10)
t.hideturtle()
t.tracer(15)
for i in range(swarmSize):
if random.randrange(100) == 0:
LeaderFish()
else:
FocalFish()
for i in range(5):
Obstacle()
for turn in range(1000):
for schooler in Schooler.swarm:
schooler.getNewHeading()
for schooler in Schooler.swarm:
schooler.setHeadingAndMove()
win.exitonclick()
开发者ID:Tyro17,项目名称:runestone,代码行数:26,代码来源:swarm.py
示例2: main
def main():
# creating a window
window = Screen()
# window.bgcolor("orange")
remo = Turtle()
remo.shape("turtle")
remo.color("green")
remo.speed(50)
for i in range(36):
remo.circle(100)
remo.left(10)
remo.color("red")
for i in range(36):
remo.circle(80)
remo.left(10)
remo.color("yellow")
for i in range(36):
remo.circle(60)
remo.left(10)
window.exitonclick()
开发者ID:kunalprompt,项目名称:computerScienceFundamentals,代码行数:28,代码来源:playing_with_turtle.py
示例3: World
class World(object):
def __init__(self, index, size_x, size_y):
self.index = index
self.canvas = Screen()
self.canvas.setup(size_x, size_y)
def show_world(self):
#self.canvas.ontimer(god.slowly_kill_humans(), 100)
self.canvas.exitonclick()
开发者ID:gorbyebrius,项目名称:utbildning,代码行数:9,代码来源:m2_world_emulator.py
示例4: main
def main():
global s
at = clock()
s = Screen()
s.bgcolor("black")
s.tracer(36, 0)
mn_eck(36, 19)
et = clock()
return "Laufzeit: %.3f sec" % (et - at)
开发者ID:DestinyHe,项目名称:python-turtle-demo,代码行数:9,代码来源:tdemo_wikipedia3.py
示例5: main
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)
开发者ID:1c71,项目名称:Program-Practice,代码行数:12,代码来源:tdemo_recursive_squares.py
示例6: MHManager
class MHManager(Turtle):
"""Special Turtle, perform the task to manage the Moorhuhn-GUI.
"""
def __init__(self, w, h):
Turtle.__init__(self, visible=False)
self.screen = Screen()
self.screen.setup(w, h)
self.speed(0)
self.penup()
self.goto(-WINWIDTH//2 + 50, -WINHEIGHT//2 + 20)
self.pencolor("yellow")
def message(self, txt):
"""Output text to graphics window.
"""
self.clear()
self.write(txt, font=("Courier", 18, "bold"))
开发者ID:s-kimmer,项目名称:tesp2016,代码行数:16,代码来源:py_moorhuhn.py
示例7: __init__
def __init__(self, w, h):
Turtle.__init__(self, visible=False)
self.screen = Screen()
self.screen.setup(w, h)
self.speed(0)
self.penup()
self.goto(-WINWIDTH//2 + 50, -WINHEIGHT//2 + 20)
self.pencolor("yellow")
开发者ID:s-kimmer,项目名称:tesp2016,代码行数:8,代码来源:py_moorhuhn.py
示例8: main
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"
开发者ID:1c71,项目名称:Program-Practice,代码行数:17,代码来源:海龟-颜色混合.py
示例9: main
def main():
global screen
screen = Screen()
screen.colormode(255)
p = Turtle()
p.ht()
screen.tracer(75,0)
u = doit1(6, Turtle(undobuffersize=1))
s = doit2(7, Turtle(undobuffersize=1))
t = doit3(5, Turtle(undobuffersize=1))
v = doit4(6, Turtle(undobuffersize=1))
w = doit5(5, Turtle(undobuffersize=1))
a = clock()
while True:
done = 0
for b in u,s,t,v,w:
try:
next(b)
except:
done += 1
if done == 5:
break
screen.tracer(1,10)
b = clock()
return "runtime: {0:.2f} sec.".format(b-a)
开发者ID:1c71,项目名称:Program-Practice,代码行数:26,代码来源:tdemo_another_forest.py
示例10: main
def main():
global s, sun
s = Screen()
s.setup(800, 600, 50, 50)
s.screensize(750, 550)
createPlanetShape()
## setup gravitational system
s.setworldcoordinates(-hfw*4/3, -hfw, hfw*4/3, hfw)
gs = GravSys()
sun = Star(mS, Vec2D(0.,0.), Vec2D(0.,0.), gs, "circle")
sun.color("yellow")
sun.turtlesize(1.8)
sun.pu()
earth = Star(mE, Vec2D(rE,0.), Vec2D(0.,vE), gs, "planet")
earth.pencolor("green")
earth.shapesize(0.8)
mercury = Star(mME, Vec2D(0., perihelME), Vec2D(-perihelvME, 0),
gs, "planet")
mercury.pencolor("blue")
mercury.shapesize(0.5)
venus = Star(mVE, Vec2D(-rVE, 0.), Vec2D(0., -vVE), gs, "planet")
venus.pencolor("blue")
venus.shapesize(0.65)
mars = Star(mMA, Vec2D(0., -rMA), Vec2D(vMA, 0.), gs, "planet")
mars.pencolor("blue")
mars.shapesize(0.45)
gs.init()
gs.start()
return "Done!"
开发者ID:DestinyHe,项目名称:python-turtle-demo,代码行数:29,代码来源:tdemo_sun_and_inner_planets.py
示例11: draw_art
def draw_art():
window = Screen()
window.bgcolor('cyan')
angie = Turtle()
angie.shape('turtle')
angie.color('blue')
angie.speed(2000)
# angie.left(105)
for j in range(80):
angie.right(5)
draw_rhombus(angie, 100)
angie.left(90)
angie.forward(300)
# Close window
window.exitonclick()
开发者ID:andela-rekemezie,项目名称:python-collections,代码行数:18,代码来源:draw_rhombus.py
示例12: main
def main():
swarmSize = 50
t = Turtle()
win = Screen()
win.setworldcoordinates(-600,-600,600,600)
t.speed(10)
t.hideturtle()
t.tracer(15)
for i in range(swarmSize):
FocalFish()
for turn in range(300):
for schooler in Schooler.swarm:
schooler.getNewHeading()
for schooler in Schooler.swarm:
schooler.setHeadingAndMove()
win.exitonclick()
开发者ID:Hndrx616,项目名称:Python-src-redact,代码行数:20,代码来源:fishSwarm.py
示例13: __init__
def __init__(self, config):
self.width = config.getValueAsInt("maze", "maze_size")
self.height = config.getValueAsInt("maze", "maze_size")
self.bg_color = config.getValue("maze", "bg_color")
self.line_color = config.getValue("maze", "line_color")
self.line_centroid_color = config.getValue("maze", "line_centroid_color")
self.forward_centroid_color = config.getValue("maze", "forward_centroid_color")
self.reverse_centroid_color = config.getValue("maze", "reverse_centroid_color")
self.path_color = config.getValue("maze", "path_color")
self.screen = Screen()
self.setupTurtle(self.width, self.height)
开发者ID:skroah,项目名称:pythonmaze,代码行数:11,代码来源:mazegraphics.py
示例14: main
def main():
swarmSize = 30
t = Turtle()
win = Screen()
win.setworldcoordinates(-600,-600,600,600)
t.speed(10)
t.tracer(15)
t.hideturtle()
for i in range(swarmSize):
Schooler()
#for turn in range(1000):
while True:
try:
for schooler in Schooler.swarm:
schooler.moveAllBoidsToNewPositions()
except KeyboardInterrupt:
break
win.exitonclick()
开发者ID:dschoemehl,项目名称:Schooling,代码行数:21,代码来源:BoidsExample.py
示例15: main
def main():
## create compound yellow/blue turtleshape for planets
s = Screen()
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)
## 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!"
开发者ID:1c71,项目名称:Program-Practice,代码行数:45,代码来源:tdemo_planet_with_moon_2.py
示例16: main
def main():
global s, sun
s = Screen()
#s.setup(800, 600)
#s.screensize(750, 550)
createPlanetShape()
## setup gravitational system
s.setworldcoordinates(-3.e11, -3e11, 3.e11, 3e11)
gs = GravSys()
sun = Star(mS, Vec2D(0.,0.), Vec2D(0.,0.), gs, "circle")
sun.color("yellow")
sun.turtlesize(1.8)
sun.pu()
earth = Star(mE, Vec2D(rE,0.), Vec2D(0.,vE), gs, "planet")
earth.pencolor("green")
earth.shapesize(0.8)
moon = Star(mM, Vec2D(rE+rM,0.), Vec2D(0.,vE+vM), gs, "planet")
moon.pencolor("blue")
moon.shapesize(0.5)
#gs.init()
gs.start()
return "Done!"
开发者ID:emailechiu,项目名称:emailechiu.github.io,代码行数:22,代码来源:tdemo_sun_earth_moon.py
示例17: principal
def principal():
janela = Screen()
janela.setup(800,600)
janela.title('Digimon, digitais, Digimon são campeões!')
janela.bgcolor('white')
carregaimagens('personagens', janela)
carregaimagens ('digimons', janela)
carregaimagens('digimonftowners', janela)
carregaimagens('fundos', janela)
cria_personagens()
abertura(janela)
ato2(janela)
ato3(janela)
ato4(janela)
ato5(janela)
ato6(janela)
ato7(janela)
ato8(janela)
#finale(janela)
fechamento(janela)
debora_animacao(janela)
开发者ID:deboraazevedo,项目名称:animacao-digimon,代码行数:21,代码来源:principal.py
示例18: __init__
def __init__(self, cols, rows):
self.cols, self.rows = cols, rows
self.screen = Screen()
self.screen.screensize(BLOCKWIDTH * cols - 50, BLOCKWIDTH * rows - 50)
self.screen.setup(BLOCKWIDTH * cols + 12, BLOCKWIDTH * rows + 12)
self.screen.title("Turtle Tetris")
self.screen.bgcolor("black")
self.writer = Turtle()
self.writer.ht()
self.label = None
self.grid = {}
self.screen.tracer(False)
for row in range(rows):
for col in range(cols):
self.grid[(col, row)] = TetrisTurtle(col, row)
self.screen.tracer(True)
self.brick = TetrisBrick(self)
self.result = 0
self.LEVEL = 0.6
self.keybuffer = KeyBuffer(self.screen, ["Right", "Left", "Up", "Down", "space", "Escape"])
self.reset()
self.screen.listen()
self.t1 = time()
开发者ID:peterfuchs1,项目名称:Turtle,代码行数:23,代码来源:pytetris.py
示例19: createPlanetShape
def createPlanetShape():
s = Screen()
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)
开发者ID:DestinyHe,项目名称:python-turtle-demo,代码行数:22,代码来源:tdemo_planet.py
示例20: main
def main():
s = Screen()
s.bgcolor("black")
p=Turtle()
p.speed(0)
p.hideturtle()
p.pencolor("red")
p.pensize(3)
s.tracer(36,0)
at = clock()
mn_eck(p, 36, 19)
et = clock()
z1 = et-at
sleep(1)
at = clock()
while any(t.undobufferentries() for t in s.turtles()):
for t in s.turtles():
t.undo()
et = clock()
return "runtime: %.3f sec" % (z1+et-at)
开发者ID:1st1,项目名称:cpython,代码行数:24,代码来源:wikipedia.py
注:本文中的turtle.Screen类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论