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


Python turtle.shape函数代码示例

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


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

示例1: show_goal_posts

 def show_goal_posts(self, goal_posts):
     for p in goal_posts:
         turtle.color("#FFFF00")
         turtle.setposition(p[0], p[1])
         turtle.shape("circle")
         turtle.stamp()
         turtle.update()
开发者ID:hendrikvgl,项目名称:RoboCup-Spielererkennung,代码行数:7,代码来源:draw.py

示例2: show_particles

    def show_particles(self, particles):
        self.update_cnt += 1
        if UPDATE_EVERY > 0 and self.update_cnt % UPDATE_EVERY != 1:
            return

        turtle.clearstamps()
        turtle.shape('tri')

        # Particle weights are shown using color variation
        show_color_weights = 1 #len(weights) == len(particles)
        draw_cnt = 0
        px = {}
        for i, p in enumerate(particles):
            draw_cnt += 1
            if DRAW_EVERY == 0 or draw_cnt % DRAW_EVERY == 1:
                # Keep track of which positions already have something
                # drawn to speed up display rendering
                scaled_x = int(p.x * self.one_px)
                scaled_y = int(p.y * self.one_px)
                scaled_xy = scaled_x * 10000 + scaled_y
                if not scaled_xy in px:
                    px[scaled_xy] = 1
                    turtle.setposition([p.x + self.width / 2, p.y + self.height / 2])
                    turtle.setheading(p.theta / pi * 180.0)
                    if(show_color_weights):
                        weight = p.w
                    else:
                        weight = 0.0
                    turtle.color(self.weight_to_color(weight))
                    turtle.stamp()
开发者ID:shreeshga,项目名称:gaussian_particlefilter,代码行数:30,代码来源:draw.py

示例3: show_sharks

    def show_sharks(self, sharks):
        self.update_cnt += 1
        if UPDATE_EVERY > 0 and self.update_cnt % UPDATE_EVERY != 1:
            return

        turtle.clearstamps()
        draw_cnt = 0
        px = {}
        for shark in sharks:
            draw_cnt += 1
            shark_shape = 'classic' if shark.tracked else 'classic'
            if DRAW_EVERY == 0 or draw_cnt % DRAW_EVERY == 0:
                # Keep track of which positions already have something
                # drawn to speed up display rendering
                scaled_x = int(shark.x * self.one_px)
                scaled_y = int(shark.y * self.one_px)
                scaled_xy = scaled_x * 10000 + scaled_y
                turtle.color(shark.color)
                turtle.shape(shark_shape)
                turtle.resizemode("user")
                turtle.shapesize(1.5,1.5,1)
                if not scaled_xy in px:
                    px[scaled_xy] = 1
                    turtle.setposition(*shark.xy)
                    turtle.setheading(math.degrees(shark.h))
                    turtle.stamp()
开发者ID:hmc-lair,项目名称:multitarget_state_estimator,代码行数:26,代码来源:draw.py

示例4: show_shark

 def show_shark(self, shark):
     turtle.color(shark.color)
     turtle.shape('turtle')
     turtle.setposition(*shark.xy)
     turtle.setheading(math.degrees(shark.h))
     turtle.stamp()
     turtle.update()
开发者ID:hmc-lair,项目名称:multitarget_state_estimator,代码行数:7,代码来源:draw.py

示例5: show_robot

 def show_robot(self, robot):
     turtle.color("blue")
     turtle.shape('square')
     turtle.setposition(*robot.xy)
     turtle.setheading(math.degrees(robot.h))
     turtle.stamp()
     turtle.update()
开发者ID:hmc-lair,项目名称:multitarget_state_estimator,代码行数:7,代码来源:draw.py

示例6: show_robot

 def show_robot(self, robot):
     turtle.color("green")
     turtle.shape('turtle')
     turtle.setposition([robot.x + self.width / 2, robot.y + self.height / 2])
     turtle.setheading(robot.theta / pi * 180.0)
     turtle.stamp()
     turtle.update()
开发者ID:shreeshga,项目名称:gaussian_particlefilter,代码行数:7,代码来源:draw.py

示例7: drawCurr

def drawCurr(currX, currY, nextX, nextY, state):
	if state == 1:
		turtle.color("red")
	else:
		turtle.color("blue")
	turtle.shape("turtle")
	startX = 0 
	startY = 0
	if(state == 1):
		startX = initX1
		startY = initY2
	else:
		startX = initX2
		startY = initY2
	prev_x_coord = startX + square_len * currY + square_len/2
	prev_y_coord = startY - square_len * currX - square_len/2

	turtle.penup()
	turtle.goto(prev_x_coord, prev_y_coord)
	
	next_x_coord = startX + square_len * nextY + square_len/2
	next_y_coord = startY - square_len * nextX - square_len/2
	
	turtle.pendown()
	if next_x_coord > prev_x_coord:
		# move right
		turtle.goto(next_x_coord, prev_y_coord)
		# move down
		turtle.goto(next_x_coord, next_y_coord)
	else:
		# move down
		turtle.goto(prev_x_coord, next_y_coord)
		# move left
		turtle.goto(next_x_coord, next_y_coord)
	turtle.penup()
开发者ID:krnbatra,项目名称:AI-Assignments,代码行数:35,代码来源:assign1.py

示例8: show_particles

    def show_particles(self, particles):
        self.update_cnt += 1
        if UPDATE_EVERY > 0 and self.update_cnt % UPDATE_EVERY != 1:
            return

        # turtle.clearstamps()
        turtle.shape('tri')

        draw_cnt = 0
        px = {}
        for p in particles:
            draw_cnt += 1
            if DRAW_EVERY == 0 or draw_cnt % DRAW_EVERY == 1:
                # Keep track of which positions already have something
                # drawn to speed up display rendering
                scaled_x1 = int(p.x1 * self.one_px)
                scaled_y1 = int(p.y1 * self.one_px)
                scaled_xy1 = scaled_x1 * 10000 + scaled_y1
                if not scaled_xy1 in px:
                    px[scaled_xy1] = 1
                    turtle.setposition(*p.xy1)
                    turtle.setheading(math.degrees(p.h))
                    turtle.color("Red")
                    turtle.stamp()

                    turtle.setposition(*p.xy2)
                    turtle.setheading(math.degrees(p.h))
                    turtle.color("Blue")
                    turtle.stamp()
开发者ID:hmc-lair,项目名称:multitarget_state_estimator,代码行数:29,代码来源:draw.py

示例9: drawLines

def drawLines(line_arr):
    turt = turtle.Turtle()
    turtle.shape("blank")
    # draws each line in the line_arr
    for line in line_arr:
        draw_single_line(line, turt)
    turtle.done()
开发者ID:PowerCouple,项目名称:Fractals,代码行数:7,代码来源:frac.py

示例10: drawPaintBoard

def drawPaintBoard():
	turtle.shape("triangle")
	turtle.penup()
	turtle.color("red")
	fillRect(0 - width,0 + height,30 -width,30 +height)
	turtle.color("blue")
	fillRect(30-width,height,60-width,30+height)
	turtle.color("#000000")
	drawRect(width,height,width-30,30+height)
	drawRect(width-30,height,width-60,height+30)
	turtle.penup()
	turtle.goto(width-15,height)
	turtle.pendown()
	turtle.circle(15)
	fillRect(width-60,height,width-90,height+30)
	drawRect(width-90,height,width-120,height+30)
	turtle.penup()
	turtle.goto(width-105,height)
	turtle.pendown()
	turtle.begin_fill()
	turtle.circle(15)
	turtle.end_fill()
	turtle.penup()
	drawRect(-15,height,15,height+30)
	turtle.goto(0,height)
	drawCursor()
	drawEraser()
	turtle.color("blue")
开发者ID:itamar16-meet,项目名称:MEET-Conf,代码行数:28,代码来源:paint.py

示例11: main

def main():
    import turtle
    turtle.forward(0)
    turtle.shape("turtle")
    turtle.color("teal")
    turtle.forward(100)
    turtle.left(120)
    turtle.forward(100)
    turtle.left(120)
    turtle.forward(100)
    turtle.left(90)  
    
    import turtle
    turtle.forward(0)
    turtle.color("red")
    turtle.forward(50)
    turtle.left(90)
    turtle.color("orange")
    turtle.forward(50)
    turtle.left(90)
    turtle.color("yellow")
    turtle.forward(50)
    turtle.left(90)
    turtle.color("green")
    turtle.forward(50)
    turtle.left(90) 
开发者ID:bakerb0473,项目名称:cti110,代码行数:26,代码来源:m5t1_Baker.py

示例12: show_robot

 def show_robot(self, robot):
     turtle.color("green")
     turtle.shape('turtle')
     turtle.setposition(*robot.xy)
     turtle.setheading(robot.h)
     turtle.stamp()
     turtle.update()
开发者ID:wellfare,项目名称:particle_filter_demo,代码行数:7,代码来源:draw.py

示例13: changeShape

def changeShape():
	global shapeList
	global currentShape
	turtle.shape(shapeList[currentShape])
	if currentShape >= len(shapeList)-1:
		currentShape = 0
	else:
		currentShape += 1
开发者ID:nathaniel16-meet,项目名称:MEET-YL1,代码行数:8,代码来源:paint.py

示例14: show_particles

    def show_particles(self, particles):
        turtle.shape('dot')

        for p in particles:
            turtle.setposition(*p.xy)
            turtle.setheading(p.h)
            turtle.color(self.weight_to_color(p.w))
            turtle.stamp()
开发者ID:ferrix,项目名称:particle_filter_demo,代码行数:8,代码来源:draw.py

示例15: show_mean

 def show_mean(self, x, y, confident=False):
     if confident:
         turtle.color("#00AA00")
     else:
         turtle.color("#cccccc")
     turtle.setposition(x, y)
     turtle.shape("circle")
     turtle.stamp()
开发者ID:MoonMaker,项目名称:Machine-Learning,代码行数:8,代码来源:draw.py


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