本文整理汇总了Python中turtle.stamp函数的典型用法代码示例。如果您正苦于以下问题:Python stamp函数的具体用法?Python stamp怎么用?Python stamp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了stamp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: 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()
示例2: printwin
def printwin(turtle):
turtle.stamp()
turtle.hideturtle()
turtle.penup()
turtle.goto(0,0)
turtle.color("green")
turtle.write("You Win!",font=("Arial",30), align = "center")
示例3: 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()
示例4: 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()
示例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()
示例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()
示例7: 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()
示例8: 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()
示例9: 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()
示例10: 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()
示例11: 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()
示例12: show_particles
def show_particles(self, particles):
turtle.clearstamps()
for p in particles:
turtle.setposition(*p.xy)
turtle.setheading(p.h)
turtle.color(self.weight_to_color(p.w))
turtle.stamp()
turtle.update()
示例13: serpinski
def serpinski(length, depth):
if depth > 1:
t.dot()
if depth == 0:
t.stamp()
else:
serpinski_draw(length, depth)
serpinski_draw(length, depth)
serpinski_draw(length, depth)
示例14: show_attraction_point
def show_attraction_point(self, att):
turtle.color('black')
turtle.shape('circle')
turtle.fillcolor("")
turtle.resizemode("user")
turtle.shapesize(1.5, 1.5, 1)
turtle.setposition(att)
turtle.setheading(0)
turtle.stamp()
turtle.update()
示例15: draw_vertex
def draw_vertex(self, domain_name, domain ):
if len(domain) == 1:
shape_name = self.colors[ domain[0] ]
else:
shape_name = "uncolored"
if shape_name != self.previous_color[domain_name]:
self.previous_color[domain_name] = shape_name
position = tuple(map(lambda x: x+0.4, self.positions[domain_name]))
turtle.shape( shape_name )
turtle.setposition( position )
turtle.stamp()