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


Python Turtle.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import __init__ [as 别名]
 def __init__(self, distance, color, speed):
     Turtle.__init__(self)
     self.pencolor(color)
     self.speed = speed
     self.penup()
     self.forward(distance)
     self.pendown()
开发者ID:ethanwhite,项目名称:assets,代码行数:9,代码来源:object-raptor-2.py

示例2: __init__

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import __init__ [as 别名]
    def __init__(self, start=(10,10), end=(160,160),
                 width=200, height=200):
        Turtle.__init__(self)
        self.hideturtle()
        self.screen.bgcolor("blue")
        self.screen.setworldcoordinates(-DISTANCE, -DISTANCE,
                                        DISTANCE+width,
                                        DISTANCE+height)

        self.screen.tracer(30,0)
        self.pensize(5)
        self.color("white", "black")
        lab = {start} 
        while True:
            new_points = set()
            for point in lab:
                x,y = map(add, point, choice(WAYS))
                if (0 <= x <= width and
                    0 <= y <= height and
                    (x,y) not in lab and
                    (x,y) not in new_points):
                    self.penup()
                    self.goto(*point)
                    self.pendown()
                    self.goto(x,y)
                    new_points.add((x,y))
            if new_points or end not in lab:
                lab |= new_points
            else:
                break
        self.mark_targets(start, end)
        self.maze_map = lab
        self.start = start
        self.end = end
        print("KONEC")
开发者ID:a1ip,项目名称:my_check,代码行数:37,代码来源:bludiste.py

示例3: __init__

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import __init__ [as 别名]
 def __init__(self, bilddatei, game):
     Turtle.__init__(self, bilddatei)
     self.game = game
     self.penup()
     self.speed(0)
     self.onclick(self.hit)
     self.start()
开发者ID:s-kimmer,项目名称:tesp2016,代码行数:9,代码来源:py_moorhuhn.py

示例4: __init__

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import __init__ [as 别名]
 def __init__(self, lmbda, mu, queue, server, speed):
     """
     Arguments:
         lmbda: arrival rate (float)
         interarrivaltime: a randomly sampled interarrival time (negative exponential for now)
         mu: service rate (float)
         service: a randomly sampled service time (negative exponential for now)
         queue: a queue object
         shape: the shape of our turtle in the graphics (a circle)
         server: a server object
         served: a boolean that indicates whether or not this player has been served.
         speed: a speed (integer from 0 to 10) to modify the speed of the graphics
         balked: a boolean indicating whether or not this player has balked (not actually needed for the base Player class... maybe remove... but might be nice to keep here...)
     """
     Turtle.__init__(self)  # Initialise all base Turtle attributes
     self.interarrivaltime = randexp(lmbda)
     self.lmbda = lmbda
     self.mu = mu
     self.queue = queue
     self.served = False
     self.server = server
     self.servicetime = randexp(mu)
     self.shape('circle')
     self.speed(speed)
     self.balked = False
开发者ID:ByronKKing,项目名称:Simulating_Queues,代码行数:27,代码来源:graphicalMM1.py

示例5: __init__

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import __init__ [as 别名]
 def __init__(self):
     Turtle.__init__(self)
     self.up()
     self.setheading(random.randrange(360))
     self.setpos(random.randrange(-200,200),random.randrange(-200,200))
     self.down()
     self.newHead = None
     Schooler.swarm.append(self)
开发者ID:Hndrx616,项目名称:Python-src-redact,代码行数:10,代码来源:fishSwarm.py

示例6: __init__

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import __init__ [as 别名]
 def __init__(self, col, row):
     Turtle.__init__(self)
     self.speed(0)
     self.pu()
     self.shape("square")
     self.color("black", "")
     self.shapesize((BLOCKWIDTH-1)/20., (BLOCKWIDTH-1)/20., 1)
     self.goto(-COLUMNS*BLOCKWIDTH/2+14+col*BLOCKWIDTH, ROWS*BLOCKWIDTH/2 - 14 - row*BLOCKWIDTH)
开发者ID:DestinyHe,项目名称:python-turtle-demo,代码行数:10,代码来源:pytetris.py

示例7: __init__

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import __init__ [as 别名]
 def __init__(self, picfile, action):
     Turtle.__init__(self)
     self.getscreen().register_shape(picfile)
     self.shape(picfile)
     def _action(x,y):
         action()
     self.onclick(_action)
     self.pu()
     self.speed(0)
开发者ID:1c71,项目名称:Program-Practice,代码行数:11,代码来源:button.py

示例8: __init__

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import __init__ [as 别名]
    def __init__(self, distance, color, speed, angle):
        Turtle.__init__(self)
        self.pencolor(color)
        self.speed = speed
        self.angle = angle

        self.penup()
        self.forward(distance)
        self.pendown()
        self.left(90)
开发者ID:LJWilliams,项目名称:assets,代码行数:12,代码来源:inherit-duckbill.py

示例9: __init__

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import __init__ [as 别名]
 def __init__(self, m, x, v, gravSys, shape):
     Turtle.__init__(self, shape)
     gravSys.planets.append(self)
     self.gravSys = gravSys
     self.dt = self.gravSys.dt
     self.penup()
     self.m = m
     self.setpos(x)
     self.vel = v
     self.pendown()
开发者ID:1c71,项目名称:Program-Practice,代码行数:12,代码来源:tdemo_sun_earth.py

示例10: __init__

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import __init__ [as 别名]
 def __init__(self, m, x, v, gravSys, shape):
     Turtle.__init__(self, shape=shape)
     self.penup()
     self.m = m
     self.setpos(x)
     self.v = v
     gravSys.planets.append(self)
     self.gravSys = gravSys
     self.resizemode("user")
     self.pendown()
开发者ID:ChowZenki,项目名称:kbengine,代码行数:12,代码来源:planet_and_moon.py

示例11: __init__

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import __init__ [as 别名]
 def __init__(self):
     Turtle.__init__(self)
     self.up()
     self.setheading(random.randrange(360))
     self.setpos(random.randrange(-200,200),random.randrange(-200,200))
     #self.down()
     self.newHead = None
     self.velocity = Vec2D(0,0)
     self.neighbordist = 200
     self.viewangle = 45
     self.neighbors = []
     Schooler.swarm.append(self)
开发者ID:dschoemehl,项目名称:Schooling,代码行数:14,代码来源:BoidsExample.py

示例12: __init__

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import __init__ [as 别名]
    def __init__(self, bilddatei, game):
        Turtle.__init__(self, bilddatei)
#        self.game = game
        self.penup()
        self.speed(0)
        self.u = 0.0
        self.v = 0.0
        self.goon = True
#        self.game = game
        self.rot = 0
        self.screenWidth = 1920 #width laptop screen
#        self.screenHeight = 745 
#        print("crosshairint")
        self.cc = 0
开发者ID:s-kimmer,项目名称:tesp2016,代码行数:16,代码来源:py_moorhuhnRoman.py

示例13: __init__

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import __init__ [as 别名]
 def __init__(self, size, shape="arrow", clickable=True):
     Turtle.__init__(self)
     self.size = size
     self.pu()
     self.shape(shape)
     self.resizemode("user")
     self.turtlesize(size,size,3)
     self.clicktime = -1
     if clickable:
         self.onclick(self.turnleft, 2)
         self.onclick(self.turnright, 3)
         self.onclick(self.store, 1)
         self.ondrag(self.move, 1)
         self.onrelease(self.match, 1)
开发者ID:DestinyHe,项目名称:python-turtle-demo,代码行数:16,代码来源:tdemo_tangram.py

示例14: __init__

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import __init__ [as 别名]
 def __init__(self,name = "", shape = "turtle", visible = False, colors = None):
   Turtle.__init__(self, shape, visible=visible)
   self._root = self._screen._root
   self.cv = Turtle._screen._canvas
   if name =="":
     self._name = self.randomString(8) # zufälliges setzen ohne Prüfung
   else:
     self.name = name                  # über die Setter wird geprüft
   if colors == None:
     self.color("black", "pink")
   else:
     self.color(colors[0],colors[1])
   self._keys = []
   self._ground = self._screen
开发者ID:itbsStefan,项目名称:ots_network_turtle,代码行数:16,代码来源:otsTurtleClasses.py

示例15: __init__

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import __init__ [as 别名]
 def __init__(self, c, r, tritype):
     Turtle.__init__(self, shape="triangle")
     self.c = c
     self.r = r
     self.speed(0)
     self.pencolor(0, 0, 0)
     if tritype == 1:
         self.basecolor = (1.0, 0.80392, 0.0)
         self.f = -1
         self.left(30)
     else:
         self.basecolor = (0.43137, 0.43137, 1.0)
         self.f = 1
         self.left(90)
     self.fillcolor(self.basecolor)
     self.pu()
     self.goto(c * A, r * A * 3 ** 0.5 / 3)
     self.shapesize(SHS, SHS, 1)
     self.D = self.distance(0, 0)
     self.e = (1 / self.D) * self.pos()
开发者ID:DestinyHe,项目名称:python-turtle-demo,代码行数:22,代码来源:tdemo_trigeo.py


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