Esempio n. 1
0
                if y == 3:
                    y = 0
                    z += 1
                cube.material.texture = f"/tmp/{node['id']}.jpg"
                cube.info = node["edge_media_to_caption"]["edges"][0]["node"][
                    "text"
                ]
                scene.add_object(node["id"], cube)


def select(list):
    global scene
    print(list[0].info)
    scene.huds["hud"].children["info"].label = list[0].info
    scene.active_observer.target_object = list[0]


scene.on_select = select
scene.create_clock("fetch_instagram", 0.1, fetch_instagram)
hud = Hud()
hud.set_font(font_file)

text = Text(
    label="Instagram Photos", color=(1, 1, 1), position=(0, 0), size=(800, 600)
)
hud.add_child("info", text)

scene.add_object("hud", hud)

scene.run()
Esempio n. 2
0
def select(list):
    global game
    global score_board
    for obj in list:
        if not obj.visible:
            continue
        obj.hide()
        score_board += 1
        game.huds["hud"].children[
            "score"].label = f"Number of balloons popped: {score_board}"


game.create_clock("balloon-creator", 1, create_balloon)
game.create_clock("move-balloons", 0.005, move_balloons)
game.on_select = select
hud = Hud()

text = Text(
    label="Hit Space to start popping the balloons!",
    position=(10, 10),
    color=(1, 1, 1),
    size=(300, 100),
)

hud.add_child("info", text)

score = Text(
    label="Number of balloons popped: 0",
    position=(10, 40),
    color=(1, 1, 1),