How to use the pyglet.app.run function in pyglet

To help you get started, we’ve selected a few pyglet 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 Permafacture / data-oriented-pyglet / examples / data_oriented_example.py View on Github external
global angles

        if done_yet():
          pyglet.app.exit()

        window.clear()
        for i, ent in enumerate(ents1):
          ent.angle+=rates1[i]

        polygon_domain1.update()
        render_domain.draw()
        fps_display.draw()

    pyglet.clock.schedule(lambda _: None)

    pyglet.app.run()
github bitcraft / PURIKURA / slideshow / display.py View on Github external
window_size = window.get_size()

if __name__ == '__main__':
    init()

    display = TableclothDisplay(window, '../images/seamless-montage.png', '.')

    pyglet.clock.set_fps_limit(120)
    pyglet.clock.schedule(scroll)
    pyglet.clock.schedule_interval(new_photo, NEW_PHOTO_INTERVAL)
    pyglet.clock.schedule_interval(check_queue, 1)

    new_photo()
    pyglet.app.run()
github Permafacture / data-oriented-pyglet / examples / first.py View on Github external
if done_yet():
      pyglet.app.exit()

    window.clear()
    for i, ent in enumerate(ents):
      angles[i]+=rates[i]
      ent.rotate_and_render(angles[i])
    draw()
    fps_display.draw()


#pyglet.clock.set_fps_limit(60)
pyglet.clock.schedule(lambda _: None)

pyglet.app.run()
github pyglet / pyglet / examples / programming_guide / window_subclass.py View on Github external
import pyglet


class HelloWorldWindow(pyglet.window.Window):
    def __init__(self):
        super(HelloWorldWindow, self).__init__()
        self.label = pyglet.text.Label('Hello, world!', x=10, y=10)

    def on_draw(self):
        self.clear()
        self.label.draw()


if __name__ == '__main__':
    window = HelloWorldWindow()
    pyglet.app.run()
github calexil / FightstickDisplay / fightstickps4.py View on Github external
center_x = 119
    center_y = 155
    x = center_x + (hat_x * 50)
    y = center_y + (hat_y * 50)
    stick_sprite.position = x, y


@window.event
def on_draw():
    window.clear()
    batch.draw()


if __name__ == "__main__":
    pyglet.clock.schedule_interval(lambda dt: None, 1/30.0)
    pyglet.app.run()
github Leohc92 / Tkinter-Projects / 04-TkPlayer / player.py View on Github external
def play_media(self):
        try:
            self.myplayer = pyglet.media.Player()    
            self.myplayer.push_handlers(on_eos=self.what_next)         
            self.source = pyglet.media.load(self.parent.currentTrack)
            self.myplayer.queue(self.source)
            self.myplayer.play()
            pyglet.app.run()
        except:
            pass
github vojtechruz / pyladies-7 / zaverecny-projekt / asteroids / v01 / asteroids.py View on Github external
objects.append(spaceship)

def draw_all_objects():
    window.clear()

    for obj in objects:
        obj.draw()



init_spaceship()
window.push_handlers(
    on_draw=draw_all_objects
)
pyglet.app.run()
github kxgames / glooey / docs / especially_useful_widgets / label.py View on Github external
#!/usr/bin/env python3

import glooey
import pyglet

window = pyglet.window.Window()
gui = glooey.Gui(window)

label = glooey.Label('Hello world!')
gui.add(label)

pyglet.app.run()
github tisnik / presentations / pyglet / 08_triangle.py View on Github external
def on_draw():
    """Obsluha události - překreslení obsahu okna."""
    glClear(GL_COLOR_BUFFER_BIT)
    glLoadIdentity()
    glBegin(GL_TRIANGLES)
    glColor3f(1, 0, 0)
    glVertex2f(window.width/2, 0)
    glColor3f(0, 1, 0)
    glVertex2f(0, window.height)
    glColor3f(0, 0, 1)
    glVertex2f(window.width, window.height)
    glEnd()


# spuštění smyčky pro zpracování událostí
pyglet.app.run()
github pynadath / psychsim / psychsim / domains / teamwork / teamwork.py View on Github external
for index in range(0, self.F_ACTORS):
                agents[index].x = int(self.world.getState('Actor' + str(index), 'x').domain()[0]) * 32
                agents[index].y = int(self.world.getState('Actor' + str(index), 'y').domain()[0]) * 32

            for index in range(0, self.E_ACTORS):
                enemies[index].x = int(self.world.getState('Enemy' + str(index), 'x').domain()[0]) * 32
                enemies[index].y = int(self.world.getState('Enemy' + str(index), 'y').domain()[0]) * 32

            for index in range(0, self.D_ACTORS):
                distractors[index].x = int(self.world.getState('Distractor' + str(index), 'x').domain()[0]) * 32
                distractors[index].y = int(self.world.getState('Distractor' + str(index), 'y').domain()[0]) * 32

        pyglet.clock.schedule_interval(update, 0.1)
        # pyglet.app.run()
        Thread(target=pyglet.app.run()).start()
        # target=pyglet.app.run()