• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python turtle.tracer函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中turtle.tracer函数的典型用法代码示例。如果您正苦于以下问题:Python tracer函数的具体用法?Python tracer怎么用?Python tracer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: rysuj

def rysuj():
    turtle.tracer(0, 0)  # wylaczenie animacji co KROK, w celu przyspieszenia
    turtle.hideturtle()  # ukrycie glowki zolwika
    turtle.penup() # podnosimy zolwia, zeby nie mazal nam linii podczas ruchu

    ostatnie_rysowanie = 0  # ile kropek temu zostal odrysowany rysunek

    for i in xrange(ILE_KROPEK):
        # losujemy wierzcholek do ktorego bedziemy zmierzac	
        do = random.choice(WIERZCHOLKI)
        # bierzemy nasza aktualna pozycje 
        teraz = turtle.position()
        # ustawiamy sie w polowie drogi do wierzcholka, ktorego wczesniej obralismy
        turtle.setpos(w_polowie_drogi(teraz, do))
        # stawiamy kropke w nowym miejscu
        turtle.dot(1)
        ostatnie_rysowanie += 1
        if ostatnie_rysowanie == OKRES_ODSWIEZENIA:
            # postawilismy na tyle duzo kropek, zeby odswiezyc rysunek
            turtle.update()
            ostatnie_rysowanie = 0

    pozdrowienia()

    turtle.update()
开发者ID:samorajp,项目名称:kompresja_fraktalna,代码行数:25,代码来源:w_polowie_drogi.py


示例2: draw

    def draw(self, x, y, width, height, max_length=None, force_fields=None):
        """Draw the string. The grammar-system axiom is extended to
        the specified depth"""
        self.reset()
        turtle.setup(width,height,None,None)
        turtle.tracer(200,0)
        self.penup()
        self.setposition(x,y)
        self.origin = x, y
        self.max_length = max_length
        while not self.grammar_system.done and \
                self.grammar_system.generation < self.depth:
            self.grammar_system.step()
            if (self.max_length is not None and
                len(self.grammar_system.string) > self.max_length):
                self.hideturtle()
                print("Drawing exceeded maximum length")
                return False
        print(self.grammar_system.string)

        if force_fields:
            for force_field in force_fields:
                self.force_fields.append(Attractor(force_field['type'], force_field['effect'], force_field['x'], force_field['y'], force_field['size']))

        non_null = self._draw(self.grammar_system.string, self._rules)
        self.hideturtle()
        turtle.update()
        return non_null
开发者ID:ElliotGluck,项目名称:ponyge,代码行数:28,代码来源:drawing.py


示例3: set

def set(): #set of parameters
    turtle.hideturtle()
    turtle.tracer(1e3,1)
    turtle.left(95)
    turtle.penup()
    turtle.goto(0,-turtle.window_height()/2)
    turtle.pendown()
开发者ID:Papapashu,项目名称:main,代码行数:7,代码来源:python_three.py


示例4: draw_maze

def draw_maze():
    t.speed(0)

    turtle.tracer(10, 25)

    t.pensize(3)
    t.penup()
    t.goto(0, 0)
    t.pendown()
    t.goto(20 * NC, 0)
    t.goto(20 * NC, 20 * NR)
    t.goto(0, 20 * NR)
    t.goto(0, 0)
    for i, ns in enumerate(nodes):
        y1, x1 = points[i]
        for n in (n for n in ns if n > i):
            y2, x2 = points[n]
            t.penup()
            if n == i + 1:
                t.goto(20 * x2, 20 * y1)
                t.pendown()
                t.goto(20 * x2, 20 * (y1 + 1))
            else:
                t.goto(20 * x1, 20 * y2)
                t.pendown()
                t.goto(20 * (x1 + 1), 20 * y2)
开发者ID:dmallows,项目名称:maze-tutorial,代码行数:26,代码来源:maze.py


示例5: setup

def setup():
    turtle.hideturtle()
    turtle.tracer(1e3,0)
    turtle.left(90)
    turtle.penup()
    turtle.goto(0,-turtle.window_height()/2)
    turtle.pendown()
开发者ID:EVGENIY2015,项目名称:cbm,代码行数:7,代码来源:tree.py


示例6: __init__

    def __init__(self, length=10, angle=90, colors=None, lsystem=None):
        import turtle
        self.length = length
        self.angle = angle
        if colors is None:
            self.colors = ['red', 'green', 'blue', 'orange', 'yellow', 'brown']
        if lsystem is not None:
            self.lsystem(lsystem)

        # draw number
        self.ith_draw = 0

        # origin of next draw
        self.origin = [0, 0]

        # bounding_box
        self._box = 0, 0, 0, 0


        # turtle head north and positive angles is clockwise
        turtle.mode('world')
        turtle.setheading(90)
        turtle.speed(0) # fastest
        turtle.hideturtle()
        turtle.tracer(0, 1)
	
        # set pencolor
        self.pencolor()
开发者ID:masterzu,项目名称:pylsys,代码行数:28,代码来源:pylsys.py


示例7: draw

    def draw(self):
        super(DragonLSystem, self).draw()

        turtle.setup(800,600)
        wn = turtle.Screen()
        wn.bgcolor('lightblue')
        wn.title("Wingled Dragon")

        self.turtle = turtle.Turtle()
        self.turtle.shape('blank')
        turtle.tracer(int(sys.argv[2]),25)
        t = self.turtle
        t.reset()

        t.penup()
        t.setpos(-200,0)
        t.pendown()
        i = 200.0
        for c in self.state:
            if c == "F":
                t.forward(math.ceil(i))
            elif c == "+":
                t.right(90)
            elif c == "-":
                t.left(90)
            elif c == "C":
                i = i/math.sqrt(2)
                t.left(45)

        wn.exitonclick()
开发者ID:mtahmed,项目名称:lsystems,代码行数:30,代码来源:dragon.py


示例8: extension1

def extension1():
	turtle.tracer(False)
	for i in range(50):
		turtle.setheading( random.randint(0,360))
		shapelib.parallelogram( random.randint(-350,-250),
							random.randint(-300, 300),
							random.random(), 'red')
	for i in range(50):
		turtle.setheading( random.randint(0,360))
		shapelib.cross( random.randint(-200, -100),
						random.randint(-300, 300),
						random.random(), 'yellow')
	for i in range(50):
		turtle.setheading( random.randint(0,360))
		shapelib.star( random.randint(-50, 50),
						random.randint(-300, 300),
						random.random(), 'pink')
	for i in range(50):
		turtle.setheading( random.randint(0,360))
		shapelib.star( random.randint(100, 200),
							random.randint(-300, 300),
							random.random(), 'orange')
	for i in range(50):
		turtle.setheading( random.randint(0,360))
		shapelib.cross( random.randint(250, 350),
						random.randint(-300, 300),
						random.random(), 'green')
	for i in range(50):
		turtle.setheading( random.randint(0,360))
		shapelib.parallelogram( random.randint(400, 500),
						random.randint(-300, 300),
						random.random(), 'blue')
开发者ID:akaralekas,项目名称:cs151-colby,代码行数:32,代码来源:RandomRepeatExtension1.py


示例9: skyobjects

def skyobjects( x, y, scale ):
	'''puts all of the objects in sky functions togehter'''
	t.tracer(False)
	star(x-300*scale, y+225*scale, 1*scale, 'True', 'orange')
	cloud(x+250*scale, y+200*scale, 1*scale, 'gray')
	cloud(x+175*scale, y+125*scale, 0.5*scale, 'gray')
	cloud(x+125*scale, y+215*scale, 0.25*scale, 'gray')
开发者ID:akaralekas,项目名称:cs151-colby,代码行数:7,代码来源:better_shapelib.py


示例10: Run

def Run():
    #bounds
    nearRange = [0, 50]
    farRange = [50, 200]
    frusHL = 100

    #Logic
    nearDist = random.uniform(nearRange[0], nearRange[1])
    farDist = random.uniform(farRange[0], farRange[1])
    d = frusHL * 2
    an = nearDist
    af = farDist
    b = (d*d + af*af - an*an) / (2 * d)
    radius = math.sqrt(b*b + an*an)
    originY = -frusHL + b

    #text.insert('end', 'Origin: %d\n' % originY)

    #Render
    turtle.clear()
    turtle.hideturtle()
    turtle.tracer(0, 0)
    turtle.penup()
    turtle.goto(-farDist, frusHL)
    turtle.pendown()
    turtle.goto(-nearDist, -frusHL)
    turtle.goto(nearDist, -frusHL)
    turtle.goto(farDist, frusHL)
    turtle.goto(-farDist, frusHL)
    turtle.penup()
    DrawCircle(0, originY, radius);
    turtle.update()
开发者ID:int-Frank,项目名称:DgLib,代码行数:32,代码来源:FrustumMinBoungingSphere.py


示例11: __init__

    def __init__(self, model):
        """Initialize the view at the starting of the application."""
        self.model = model

        self.cellWidth = self.CELL_WIDTH
        self.model = model
        self.gridSize = model.GRID_SIZE
        self.player = self.model.player1
        self.screen = turtle.Screen()
        self.gridWidth = self.CELL_WIDTH * self.gridSize
        self.playerGrid = self.player.getGrid(self.player.PLAYER_GRID)
        self.enemyGrid = self.player.getGrid(self.player.OPPONENT_GRID)
        self.iconsToDraw = []

        turtle.title('BATTLESHIP : {} vs {}'.format(
            self.model.player1.playerName, self.model.player2.playerName))
        self.__setScreen()
        self.__setColor()
        turtle.tracer(0, 0)

        gridWidth = self.gridWidth
        gridAnchorPoints = []
        gridAnchorPoints.append((
            -self.width/2 + self.GRID_MARGINLEFT,
            self.height/2 - self.GRID_MARGINTOP - gridWidth))
        gridAnchorPoints.append((
            self.width/2 - gridWidth - self.GRID_MARGINRIGHT,
            self.height/2 - self.GRID_MARGINTOP - gridWidth ))

        self.__drawGrid(gridAnchorPoints[0], gridWidth)
        self.__drawGrid(gridAnchorPoints[1], gridWidth)

        self.gridAnchorPoints = gridAnchorPoints
开发者ID:raphaelgodro,项目名称:BattleShip-Human-AI-Network,代码行数:33,代码来源:view_window.py


示例12: foliageRight

def foliageRight( x, y, scale):
	''' foliage scenery right side of image
			use tree() and leaf() functions defined earlier
			to make a variety of size and color foliage
			using for loops to make multiple'''
	t.tracer(False)
	for i in range(5):
		tree( x+random.randint( 100, 350 )*scale,
				y+random.randint( -300, -100 )*scale,
				random.randint( 1, 2 )*scale)
	for i in range(10):
		leaf( x+random.randint( 100, 300 )*scale,
				y+random.randint( -300, -100 )*scale,
				random.random()*scale,
				'red' )
	for i in range(10):
		leaf( x+random.randint( 100, 300 ),
				y+random.randint( -300, -100 ),
				random.random()*scale,
				'orange' )
	for i in range(10):
		leaf( x+random.randint( 100, 300 )*scale,
				y+random.randint( -300, -100 )*scale,
				random.random()*scale,
				'yellow' )	
开发者ID:akaralekas,项目名称:cs151-colby,代码行数:25,代码来源:better_shapelib.py


示例13: setTurtle

 def setTurtle(self):
     """Initializes the turtle object and screen object, while also setting the speed to the maximum"""
     
     self.t = turtle.Turtle()
     self.s = turtle.Screen()
     self.t.speed(0)
     turtle.tracer(0,0)
开发者ID:Joe-McCann,项目名称:My-Projects,代码行数:7,代码来源:TicTacToe3_JoeVai.py


示例14: setup

def setup():
    turtle.hideturtle()
    turtle.tracer(1e3,0)
    turtle.left(90)
    turtle.penup()
    turtle.goto(-100,-100)
    turtle.pendown()
开发者ID:zmeiko,项目名称:pythonImage,代码行数:7,代码来源:Lab1.py


示例15: tree1

def tree1(argv, x, y):
	lsys_filename1 = argv[1]
	lsys1 = ls.createLsystemFromFile( lsys_filename1 )
	print lsys1
	num_iter1 = int( 3 )
	dist = float( 5 )
	angle1 = float( 22 )
	
	s1 = ls.buildString( lsys1, num_iter1 )
	
	#draw lsystem1
	'''this is my first lsystem
		with filename mysystem1.txt
		with 3 iterations and
		with angle = 45 dist = 10'''
	turtle.tracer(False)
	turtle.speed(50000000)
	turtle.up()
	turtle.goto(0,0)
	turtle.goto(x, y)
	turtle.down()
	turtle.pencolor('White')
	it.drawString( s1, dist, angle1 )
	
	# wait and update
	turtle.update()
开发者ID:akaralekas,项目名称:cs151-colby,代码行数:26,代码来源:project7extension.py


示例16: drawSetup

def drawSetup(title,xlimits,xscale,ylimits,yscale,axisThickness=None):
	turtle.title(title)
	xmin, xmax = xlimits
	ymin, ymax = ylimits
	#turtle.setup(xmax-xmin,ymax-ymin,0,0) #window-size
	globals()['xmin'] = xmin
	globals()['xmax'] = xmax
	globals()['ymin'] = ymin
	globals()['ymax'] = ymax
	globals()['xscale'] = xscale
	globals()['yscale'] = yscale

	turtle.setworldcoordinates(xmin,ymin,xmax,ymax)
	#turtle.speed(0) #turtle.speed() does nothing w/ turtle.tracer(0,0)
	turtle.tracer(0,0)

	drawGrid()
	#drawGridBorder()
	
	turtle.pensize(axisThickness)

	drawXaxis()
	drawXtickers()
	numberXtickers()
	
	drawYaxis()
	drawYtickers()
	numberYtickers()

	turtle.pensize(1)
开发者ID:Cacharani,项目名称:Graph-Kit,代码行数:30,代码来源:graphkit.py


示例17: __init__

    def __init__(self):
        # Janela sobre
        self.janSobre = None


        # Cor de fundo
        self.corFundo = "gray"


        turtle.screensize(1000, 700, self.corFundo)
        turtle.setup(width=1000, height=700)
        turtle.title("cidadeBela - Janela de desenho")


        turtle.speed(0)
        turtle.tracer(4)

        # Definindo variáveis globais
        self._tamPadrao = ""

        # Listas de prédios
        self.predios = ['Casa', 'Hotel']
        self.prediosProc = [ 'hotel', 'hotelInv', 'casa', 'casaInv' ]


        # Sorteando elementos
        self.sorteioPredios    = [["casa", 1], ["hotel", 1]]
        self.sorteioPrediosInv = [["casaInv", 1], ["hotelInv", 1]]


        #  Cores dos prédios
        self.coresHotel = ["076080190", "255255255", "167064057", "153204255", "000090245",
                           "201232098", "255058123", "010056150", "130255255", "255255000",
                           "255000000", "255127042", "000255000", "255170255", "000255170",
                           "212000255", "170255127", "127212255", "255127127", "255212085",
                           "212212255", "255255127", "222202144" ]
        self.coresCasa  = ['209187103', '115155225', '130047006', '255137111', '203229057',
                           '017130100', '025195159', '204057065', '194082255', '092221159',
                           '167045055', '238243030', '069241248', '000156228', '159094040',
                           '048033253', '040209239', '138164253', '190042177', '000122159',
                           '255255255', '253208201', '245228133']
        self.coresLoja  = ['255255255', '253208201', '245228133' ]

        #  Janelas dos prédios
        self.janelasHotel = janelas.janelasHotel
        self.janelasCasa  = janelas.janelasCasa
        self.janelasLoja  = janelas.janelasLoja
        self.janelasTodas = janelas.janelasTodas

        #  Tetos dos prédios
        self.tetosHotel = tetos.tetosHotel
        self.tetosCasa  = tetos.tetosCasa
        self.tetosLoja  = tetos.tetosLoja
        self.tetosTodas = tetos.tetosTodas

        #  Portas dos prédios
        self.portasHotel = portas.portasHotel
        self.portasCasa  = portas.portasCasa
        self.portasLoja  = portas.portasLoja
        self.portasTodas = portas.portasTodas
开发者ID:SrMouraSilva,项目名称:Academic-Projects,代码行数:60,代码来源:cb.py


示例18: floor

def floor( x, y, scale ):
	t.tracer(False)
	position1 = [-600, -500, -400, -300, -200, -100, 0, 100, 200, 300, 400, 500]
	position2 = [-550, -450, -350, -250, -150, -50, 50, 150, 250, 350, 450,  550]
	for i in range(len(position1)):
		t.begin_fill()
		t.color('Black')
		bsl.buildingblock(x+position1[i]*scale, y-300*scale, 50*scale, 50*scale)
		t.end_fill()
	for i in range(len(position1)):
		t.begin_fill()
		t.color('Gold')
		bsl.buildingblock(x+position2[i]*scale, y-300*scale, 50*scale, 50*scale)
		t.end_fill()
	for i in range(len(position1)):
		t.begin_fill()
		t.color('Gold')
		bsl.buildingblock(x+position1[i]*scale, y-250*scale, 50*scale, 50*scale)
		t.end_fill()
	for i in range(len(position1)):
		t.begin_fill()
		t.color('Black')
		bsl.buildingblock(x+position2[i]*scale, y-250*scale, 50*scale, 50*scale)
		t.end_fill()
	for i in range(len(position1)):
		t.begin_fill()
		t.color('Black')
		bsl.buildingblock(x+position1[i]*scale, y-200*scale, 50*scale, 50*scale)
		t.end_fill()
	for i in range(len(position1)):
		t.begin_fill()
		t.color('Gold')
		bsl.buildingblock(x+position2[i]*scale, y-200*scale, 50*scale, 50*scale)
		t.end_fill()
开发者ID:akaralekas,项目名称:cs151-colby,代码行数:34,代码来源:taskII.py


示例19: draw

  def draw(self, w, h, dot = False):
    norm = CoordinateNormalizer(self, w, h)
    window = turtle.Screen()
    cursor = turtle.Turtle()

    window.setup(w, h)
    window.setworldcoordinates(0, 0, w, h)
    window.delay(0)

    cursor.ht()

    turtle.tracer(0)

    cursor.up()
    for way in self.getWays():
      tags = self.ways[way].tags
      line = self.getPolyline(way)
      for (x, y) in line:
        cursor.pencolor('black')
        x, y = norm(x, y)
        cursor.setpos(x, y)
        if dot:
          cursor.dot()
        if not cursor.isdown():
          cursor.down()
      cursor.up()

    turtle.update()

    window.exitonclick()
开发者ID:SmashMouthFanClub,项目名称:ai-project-2014,代码行数:30,代码来源:osm.py


示例20: initialize_plot

   def initialize_plot(self, positions):
      self.positions = positions
      self.minX = minX = min(x for x,y in positions.values())
      maxX = max(x for x,y in positions.values())
      minY = min(y for x,y in positions.values())
      self.maxY = maxY = max(y for x,y in positions.values())
      
      ts = turtle.getscreen()
      if ts.window_width > ts.window_height:
          max_size = ts.window_height()
      else:
          max_size = ts.window_width()
      self.width, self.height = max_size, max_size
      
      turtle.setworldcoordinates(minX-5,minY-5,maxX+5,maxY+5)
      
      turtle.setup(width=self.width, height=self.height)
      turtle.speed("fastest") # important! turtle is intolerably slow otherwise
      turtle.tracer(False)    # This too: rendering the 'turtle' wastes time
      turtle.hideturtle()
      turtle.penup()
      
      self.colors = ["#d9684c","#3d658e","#b5c810","#ffb160","#bd42b3","#0eab6c","#1228da","#60f2b7" ]

      for color in self.colors:         
         s = turtle.Shape("compound")
         poly1 = ((0,0),(self.cell_size,0),(self.cell_size,-self.cell_size),(0,-self.cell_size))
         s.addcomponent(poly1, color, "#000000")
         turtle.register_shape(color, s)
      
      s = turtle.Shape("compound")
      poly1 = ((0,0),(self.cell_size,0),(self.cell_size,-self.cell_size),(0,-self.cell_size))
      s.addcomponent(poly1, "#000000", "#000000")
      turtle.register_shape("uncolored", s)
开发者ID:jorgenkg,项目名称:IT3105,代码行数:34,代码来源:visuals.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python turtle.up函数代码示例发布时间:2022-05-27
下一篇:
Python turtle.title函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap