How to use the payton.scene.gui.info_box function in Payton

To help you get started, we’ve selected a few Payton examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sinanislekdemir / payton / examples / basics / 12_1_collision_detailed.py View on Github external
scene.add_object("acar1", aabb_car_1)
scene.add_object("acar2", aabb_car_2)

spherical_collision.add_object(spherical_car_1)
spherical_collision.add_object(spherical_car_2)

aabb_collision.add_object(aabb_car_1)
aabb_collision.add_object(aabb_car_2)

scene.add_collision_test("spherical_collision", spherical_collision)
scene.add_collision_test("aabb_collision", aabb_collision)

scene.create_clock("motion", 0.01, motion)

scene.add_object(
    "info", info_box(left=10, top=10, width=220, height=100, label="Hit SPACE\nto start animation",),
)

scene.run()
github sinanislekdemir / payton / examples / basics / 28_ragdoll.py View on Github external
self.ragdoll = RagDoll()
        self.state = 1
        self.total_ang = 0
        self.add_object("ragdoll", self.ragdoll)
        self.create_clock("walk", 0.01, self.walk)
        self.add_object("ground", Plane(20, 20))

        self.target = [5, 0, 2]
        self.ragdoll.direct_to([5, 0, 2])

        self.ragdoll.joints[R_SHOULDER].rotate_around_y(math.radians(50))
        self.ragdoll.joints[L_SHOULDER].rotate_around_y(math.radians(-50))
        self.ragdoll.joints[R_KNEE].rotate_around_x(math.radians(-20))
        self.ragdoll.joints[L_KNEE].rotate_around_x(math.radians(-20))
        self.add_object(
            "info", info_box(left=10, top=10, width=220, height=100, label="Hit SPACE\nto start animation",),
        )
github sinanislekdemir / payton / examples / basics / 20_background.py View on Github external
minutes = 0


def change_background(period, total):
    global minutes
    h = int(minutes / 60) % 24
    m = minutes % 60
    scene.background.set_time(h, m)
    minutes += 10


scene = Scene()
scene.create_clock("sun", 0.1, change_background)

scene.add_object(
    "info", info_box(left=10, top=10, width=220, height=100, label="Hit SPACE\nto start animation",),
)

scene.run()
github sinanislekdemir / payton / examples / basics / 22_go_back.py View on Github external
def step_back_history(period, total):
    success = scene.objects["cube"].step_back()
    if not success:
        scene.clocks["back"].pause()


cube = Cube()
cube.track_motion = True
scene.add_object("cube", cube)
scene.create_clock("forward", 0.2, move_forward)
scene.create_clock("back", 0.2, step_back_history)

scene.add_object(
    "info", info_box(left=10, top=10, width=220, height=100, label="Hit SPACE\nto start animation",),
)

scene.run()
github sinanislekdemir / payton / examples / basics / 33_better_lines.py View on Github external
for i in range(20):
            x = random.randint(-1000, 1000) / 100
            y = random.randint(-1000, 1000) / 100
            z = random.randint(-1000, 1000) / 100
            self.line.append(vertices=[[x, y, z]])
            v = normalize_vector([x, y, z])
            if random.randint(0, 1) == 1:
                v = scale_vector(v, -1)
            self.vertex_velocities.append(v)

        self.add_object("line", self.line)
        self.create_clock("clock", 0.01, self.animate)
        self.background.top_color = BLACK
        self.background.bottom_color = BLACK
        self.add_object(
            "info", info_box(left=10, top=10, width=220, height=100, label="Hit SPACE\nto start animation",),
        )
github sinanislekdemir / payton / examples / basics / 26_quake2.py View on Github external
def keyboard(self, event, scene):
        super().keyboard(event, scene)
        if event.type == sdl2.SDL_KEYUP:
            key = event.key.keysym.sym
            if key == sdl2.SDLK_UP:
                model.animate("walk", 0, 52)
            if key == sdl2.SDLK_DOWN:
                model.animate("death", 0, 76, False)


label = """
Hit Keyboard UP to walk
Hit Keyboard Down to death animation
"""

scene.add_object("info", info_box(left=10, top=10, width=320, height=100, label=label))

scene.add_object("ground", ground)
scene.add_object("infantry", model)
scene.controller = CustomKeyboardControls()
model.bake_animation("walk", 2, 14, 3)
model.bake_animation("death", 0, 19, 3)
print(model.animations)
model.animate("walk", 0, 52)
scene.run()
github sinanislekdemir / payton / examples / basics / 24_object_oriented.py View on Github external
def __init__(self, **kwargs):
        super().__init__(**kwargs)
        cube = Cube()
        self.add_object("cube", cube)
        self.create_clock("rotator", 0.01, self.timer)
        self.add_object(
            "info", info_box(left=10, top=10, width=220, height=100, label="Hit SPACE\nto start animation",),
        )
github sinanislekdemir / payton / examples / basics / 04_clock.py View on Github external
ball = Sphere(radius=1, track_motion=True)

# Add ball to the scene
scene.add_object("ball", ball)
scene.active_observer.target_object = ball  # Track the ball

scene.grid.resize(30, 30, 2)
ground = Plane(80, 80)
scene.add_object("gr", ground)

scene.create_clock("motion", 0.005, projectile_motion)
scene.create_clock("logger", 0.05, logger)

scene.add_object(
    "info", info_box(left=10, top=10, width=220, height=100, label="Hit SPACE\nto start animation",),
)

scene.run()
github sinanislekdemir / payton / examples / mid-level / balloon.py View on Github external
# Re-use the existing objects
    global score_board
    for obj in list:
        x = random.randint(-5, 5)
        y = random.randint(-5, 5)
        z = random.randint(10, 20)
        obj.position = [x, y, z]
        score_board += 1


game.create_clock("move-balloons", 0.02, move_balloons)
game.on_select = select
create_balloons()

game.add_object(
    "info", info_box(left=10, top=10, width=220, height=100, label="Hit SPACE to\nstart popping!",),
)

game.run()
github sinanislekdemir / payton / examples / basics / 05_children.py View on Github external
earth = Sphere(radius=5, parallels=36, meridians=36)
earth.material.texture = texture_file
moon = Sphere()
moon.position = [8, 0, 0]

moon_moon = Sphere(radius=0.5)
moon_moon.position = [0, 2, 0]

earth.add_child("moon", moon)
moon.add_child("moon_moon", moon_moon)

space.add_object("earth", earth)

space.create_clock("motion", 0.01, motion)
space.add_object(
    "info", info_box(left=10, top=10, width=220, height=100, label="Hit SPACE\nto start animation",),
)

space.run()