Esempio n. 1
0
def get_mp3(text):
    text = text.replace(";", " beep ")
    text = text.translate(string.maketrans("", ""), string.punctuation)
    # text = text.replace(",", "")

    lowertext = text.lower()
    words = lowertext.split()
    player.queue(beep)
    for inword in words:
        try:
            word = int(inword)
        except:
            word = inword
        save_path = cwd + '\\tts_downloads\\{}.mp3'.format(word)
        if os.path.isfile(save_path) == False:
            # tts = gTTS(word, 'en-us')
            # tts.save(save_path)
            voicename = random.choice(vonavoices)
            pvoice.voice_name = voicename
            pvoice.fetch_voice(word, save_path)

        mp3 = media.load(save_path)
        player.queue(mp3)
    player.queue(beep)
    player.play()
    clock.schedule_interval(exit_callback, 1 / 10.0)
    app.run()
    print '\n' + text
Esempio n. 2
0
def test_view():
	global map_width
	map_ = Map(values.map_width, values.map_height)
	for i in range(values.banks):
		map_.add(EnergyBank(map_, random()))
	for i in range(values.bodies):
		map_.add(Body(map_, random()))

	def update(dt):
		map_.tick()


	sim = Window(map_.width, map_.height)
	sim_view = SimView(map_)
	schedule_interval(update, 0.1)

	@sim.event
	def on_draw():
		glClearColor(.5, .6, .6, 1)
		sim.clear()
		sim_view.draw()


	graph = Window(500, 100)
	graph_view = GraphView(map_)

	@graph.event
	def on_draw():
		graph.clear()
		graph_view.draw()


	app.run()
Esempio n. 3
0
 def testMultilineFalse(self):
     self.window = TestWindow(
           multiline=False, wrap_lines=False,
           msg=nonewline_nowrap, resizable=True, visible=False)
     self.window.set_visible()
     app.run()
     self.user_verify('Pass test?', take_screenshot=False)
Esempio n. 4
0
 def testMultilineFalse(self):
     self.window = TestWindow(multiline=False,
                              wrap_lines=False,
                              msg=nonewline_nowrap,
                              resizable=True,
                              visible=False)
     self.window.set_visible()
     app.run()
Esempio n. 5
0
    def __init__(self):
        super(GameWindow, self).__init__()
        clock.schedule_interval(self.on_update, 1.0 / 60)

        self.quad_sprite = Quad(self, 1, 1, scale=3)
        self.game_map = Map(self, 0, 0)

        app.run()
Esempio n. 6
0
 def testMultilineTrueLimited(self):
     self.window = TestWindow(multiline=True,
                              wrap_lines=True,
                              msg=newline_wrap,
                              resizable=True,
                              visible=False)
     self.window.set_visible()
     app.run()
Esempio n. 7
0
    def run(self):
        """Start the game.

        """
        self.setup_pyglet()
        self.setup_gl()
        self.switch_handler("menu")
        self.window.set_visible()
        app.run()
Esempio n. 8
0
def mainly(first, simple_moving_list, kindly, detailed_list):
    global list_draw, step, array, cost, number_up, number_down, kind, \
     detailed_step
    step = simple_moving_list
    array = list(first)
    kind = kindly
    detailed_step = detailed_list[:]
    number_label(array)
    app.run()
Esempio n. 9
0
    def run(self):
        """Start the game.

        """
        self.setup_pyglet()
        self.setup_gl()
        self.switch_handler(config.start_mode)
        self.window.set_visible()
        app.run()
Esempio n. 10
0
    def run(self):
        """Start the game.

        """
        self.setup_pyglet()
        self.setup_gl()
        self.switch_handler(config.start_mode)
        self.window.set_visible()
        app.run()
Esempio n. 11
0
def main():
    import ctypes
    import time

    from pyglet import app, clock, font, gl, image, window

    from MusicDefs import MusicDefs

    #pic = PianoOctavePic(width=400, height=200)
    pic = HexagonalLayoutPic(D=100, scale=SCALE_MAJOR_DIATONIC, tonic=1, h=4)

    window = window.Window(width=pic.width, height=pic.height)
    #ft = font.load('Arial', 24)
    #text = font.Text(ft, 'Hello World')

    # create data shared by ImageSurface and Texture
    data = (ctypes.c_ubyte * (pic.width * pic.height * 4))()
    stride = pic.width * 4
    surface = cairo.ImageSurface.create_for_data(data, cairo.FORMAT_ARGB32,
                                                 pic.width, pic.height, stride)
    texture = image.Texture.create_for_size(gl.GL_TEXTURE_2D,
                                            pic.width * pic.height, gl.GL_RGBA)

    def update_surface(dt, surface):
        ctx = cairo.Context(surface)
        pic.draw_pic(ctx)

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

        gl.glEnable(gl.GL_TEXTURE_2D)

        gl.glBindTexture(gl.GL_TEXTURE_2D, texture.id)
        gl.glTexImage2D(gl.GL_TEXTURE_2D, 0, gl.GL_RGBA, pic.width, pic.height,
                        0, gl.GL_BGRA, gl.GL_UNSIGNED_BYTE, data)

        gl.glBegin(gl.GL_QUADS)
        gl.glTexCoord2f(0.0, 1.0)
        gl.glVertex2i(0, 0)
        gl.glTexCoord2f(1.0, 1.0)
        gl.glVertex2i(pic.width, 0)
        gl.glTexCoord2f(1.0, 0.0)
        gl.glVertex2i(pic.width, pic.height)
        gl.glTexCoord2f(0.0, 0.0)
        gl.glVertex2i(0, pic.height)
        gl.glEnd()

        #text.draw()

        #print('FPS: %f' % clock.get_fps())

    clock.schedule_interval(update_surface, 1 / 120.0, surface)
    app.run()
Esempio n. 12
0
def _main():

    #initialize main game

    from libraries.main import init, close

    init()

    try:
        run()
    finally:
        close()
Esempio n. 13
0
def main():
    win = Window(fullscreen=True)
    win.on_resize = on_resize
    try:

        try:
            install_shaders('allGreen.frag', 'zoomRotate.vert')
        except ShaderError, e:
            print str(e)
            return 2
        
        win.on_draw = lambda: on_draw(win)
        app.run()
Esempio n. 14
0
def main():
    title_screen()
    setup_screen()
    join_screen()
    host_screen()
    game_screen()
    end_screen()

    manager.set_media(mp)
    manager.add_widget(my_bg)
    game_window.push_handlers(manager)
    # Pyglet Settings
    schedule_interval(update, 1 / 120.0)
    set_fps_limit(120)
    run()
Esempio n. 15
0
File: run.py Progetto: msarch/py
def main():
    win = Window(fullscreen=True, visible=False)
    camera = Camera(win.width, win.height, (0, 0), 100)
    renderer = Renderer()
    maze = Maze()
    maze.create(50, 30, 300)
    keyboard = Keyboard()
    keyboard.key_handlers[key.ESCAPE] = win.close
    keyboard.key_handlers.update(camera.key_handlers)
    clock.schedule(maze.update)
    win.on_draw = lambda: renderer.on_draw(maze, camera, win.width, win.height)
    win.on_key_press = keyboard.on_key_press
    keyboard.print_handlers()
    win.set_visible()
    app.run()
Esempio n. 16
0
def main():
	title_screen()
	setup_screen()
	join_screen()
	host_screen()
	game_screen()
	end_screen()

	manager.set_media(mp)
	manager.add_widget(my_bg)
	game_window.push_handlers(manager)
	#Pyglet Settings
	schedule_interval(update, 1/120.0)
	set_fps_limit(120)
	run()
Esempio n. 17
0
File: run.py Progetto: msarch/py
def main():
    win = Window(fullscreen=True, visible=False)
    camera = Camera(win.width, win.height, (0, 0), 100)
    renderer = Renderer()
    maze = Maze()
    maze.create(50, 30, 300)
    keyboard = Keyboard()
    keyboard.key_handlers[key.ESCAPE] = win.close
    keyboard.key_handlers.update(camera.key_handlers)
    clock.schedule(maze.update)
    win.on_draw = lambda: renderer.on_draw(maze, camera, win.width, win.height)
    win.on_key_press = keyboard.on_key_press
    keyboard.print_handlers()
    win.set_visible()
    app.run()
Esempio n. 18
0
def main_pyglet():
    import ctypes
    import time

    from pyglet import app, clock, font, gl, image, window

    from MusicDefs import MusicDefs

    pic = PianoOctavePic(width=600, height=150, num_octaves=5)
    win = window.Window(width=pic.width, height=pic.height)

    # create data shared by ImageSurface and Texture
    data = (ctypes.c_ubyte * (pic.width * pic.height * 4))()
    stride = pic.width * 4
    surface = cairo.ImageSurface.create_for_data(data, cairo.FORMAT_ARGB32,
                                                 pic.width, pic.height, stride)
    texture = image.Texture.create_for_size(gl.GL_TEXTURE_2D,
                                            pic.width * pic.height, gl.GL_RGBA)

    def update_surface(dt, surface):
        ctx = cairo.Context(surface)
        pic.draw_pic(ctx)

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

        gl.glEnable(gl.GL_TEXTURE_2D)

        gl.glBindTexture(gl.GL_TEXTURE_2D, texture.id)
        gl.glTexImage2D(gl.GL_TEXTURE_2D, 0, gl.GL_RGBA, pic.width, pic.height,
                        0, gl.GL_BGRA, gl.GL_UNSIGNED_BYTE, data)

        gl.glBegin(gl.GL_QUADS)
        gl.glTexCoord2f(0.0, 1.0)
        gl.glVertex2i(0, 0)
        gl.glTexCoord2f(1.0, 1.0)
        gl.glVertex2i(pic.width, 0)
        gl.glTexCoord2f(1.0, 0.0)
        gl.glVertex2i(pic.width, pic.height)
        gl.glTexCoord2f(0.0, 0.0)
        gl.glVertex2i(0, pic.height)
        gl.glEnd()

        #print('FPS: %f' % clock.get_fps())

    clock.schedule_interval(update_surface, 1 / 120.0, surface)
    app.run()
Esempio n. 19
0
    def test_content_valign_center(self):
        """Test content_valign = 'center' property of IncrementalTextLayout.

        Examine and type over the text in the window that appears.  The window
        contents can be scrolled with the mouse wheel.  When the content height
        is less than the window height, the content should be aligned to the center
        of the window.

        Press ESC to exit the test.
        """
        self.window = TestWindow(resizable=True,
                                 visible=False,
                                 content_valign='center')
        self.window.set_visible()
        app.run()
        self.user_verify('Test passed?', take_screenshot=False)
Esempio n. 20
0
    def demo_main(demo_class, size=(640,480), title="Enable Example"):
        """ Runs a simple application in Pyglet using an instance of
        **demo_class** as the main window or frame.

        **demo_class** should be a subclass of DemoFrame or the pyglet
        backend's Window class.
        """
        if issubclass(demo_class, DemoFrame):
            frame = demo_class()
            if frame.enable_win is not None:
                window = frame.enable_win.control
            else:
                window = None
        else:
            window = demo_class().control

        if window is not None:
            if not window.fullscreen:
                window.set_size(*size)
            window.set_caption(title)

        app.run()
Esempio n. 21
0
    def init_Viewer(self):
        """
        Open the pyglet window and initiate OpenGL from within
        viewer.Viewer
        """
        if self.participant:
            enable_stereo = self.participant['stereo']
        else:
            enable_stereo = False

        # Setup the config
        config = Config(depth_size=DEPTH_SIZE, double_buffer=True,
                        sample_buffers=1, samples=4,
                        stereo=enable_stereo)
        # Open the window using pyglet
        self.window = Viewer(self.participant,
                             caption=EXP_NAME,
                             config=config, fullscreen=FULLSCREEN,
                             resizable=False, screen=0)

        # Run pyglet
        run()
    def demo_main(demo_class, size=(640, 480), title="Enable Example"):
        """ Runs a simple application in Pyglet using an instance of
        **demo_class** as the main window or frame.

        **demo_class** should be a subclass of DemoFrame or the pyglet
        backend's Window class.
        """
        if issubclass(demo_class, DemoFrame):
            frame = demo_class()
            if frame.enable_win is not None:
                window = frame.enable_win.control
            else:
                window = None
        else:
            window = demo_class().control

        if window is not None:
            if not window.fullscreen:
                window.set_size(*size)
            window.set_caption(title)

        app.run()
Esempio n. 23
0
def main():
    sendQ = Queue()
    recvQ = Queue()
    #setup net stack
    factory = MMFEClient(recvQ=sendQ, sendQ=recvQ, url="ws://localhost:9000", debug=False)
    factory.protocol = MMFEClientProtocol
    connectWS(factory)
    net = Process(target=reactor.run)

    #setup game stack
    game_window = window.Window()
    label = text.Label('Hello, world', font_name='Arial', font_size=16, x=game_window.width//2, y=game_window.height//2, anchor_x='center', anchor_y='center')
    @game_window.event
    def on_draw():
        game_window.clear()
        label.draw()
        if not recvQ.empty():
            data = recvQ.get()
            if 'label' in data:
                label.text = data['label']

    net.start()
    app.run()
Esempio n. 24
0
    def __init__(self, seed, savegame, name):
        super(OfflineGame, self).__init__()
        self.savingstate = SaveState(name=name)
        self.window = Window(self)
        self.renderer = Renderer(self)

        if not savegame:
            self.player = Player(self)
            self.world = World(self)
            self.world.create(seed)
        else:
            self.savingstate.savename = name
            self.player = Player(self)



        # self.renderer.overlay.inventory.create
        self.peripherals = PeripheralDeviceHandler(self)
        self.peripherals.add('keyboard', KeyBoard, (self,))
        self.peripherals.add('mouse', Mouse, (self,))
        self.peripherals.pushAll()
        self.run()

        run()
Esempio n. 25
0
 def test(self):
     self.window = TestWindow(resizable=True, visible=False)
     self.window.set_visible()
     app.run()
     self.user_verify('Pass test?', take_screenshot=False)
def main():
	#clock.schedule(update)
	load()
	app.run()
	pass
                cube(size=(10, 10, 10), color=(0.5, 0.5, 0.5, 1.0))

        fps.draw()
        description.draw()

    @window.event
    def on_key_press(symbol, modifiers):
        if symbol == key.UP:
            box.add_impulse(linear=(0, 5, 0))
        elif symbol == key.DOWN:
            box.add_impulse(linear=(0, -5, 0))
        elif symbol == key.LEFT:
            box.add_impulse(linear=(-5, 0, 0))
        elif symbol == key.RIGHT:
            box.add_impulse(linear=(5, 0, 0))
        elif symbol == key.DELETE:
            box.add_impulse(torque=(0, 0, 5))
        elif symbol == key.PAGEDOWN:
            box.add_impulse(torque=(0, 0, -5))
        elif symbol == key.HOME:
            box.add_impulse(torque=(-5, 0, 0))
        elif symbol == key.END:
            box.add_impulse(torque=(5, 0, 0))

    def simulate(delta):
        world.step(delta, iterations=10)

    schedule_interval(simulate, 0.005)

    run()
Esempio n. 28
0
 def run(self):
     app.run()
Esempio n. 29
0
 def testMultilineTrueLimited(self):
     self.window = TestWindow(
         multiline=True, wrap_lines=True,
         msg=newline_wrap, resizable=True, visible=False)
     self.window.set_visible()
     app.run()
Esempio n. 30
0
def startGame():
    app.run()
        with nested(Projection(0, 0, window.width, window.height, far=1000.0), Matrix, Lighting):
            glTranslatef(0, 0, -500)
            glRotatef(tilt*0.3, 1.0, 0, 0)
            glRotatef(rotate*0.3, 0.0, 1.0, 0)

            for body in bodies:
                with Matrix:
                    glMultMatrixf(body.matrix)
                    cube(size=body.size, color=(0.5, 0.5, 0.5, 1.0))

        fps.draw()
        description.draw()

    keys = pyglet.window.key.KeyStateHandler()
    window.push_handlers(keys)

    constant = 300.0
    def simulate(delta):
        for i, body1 in enumerate(bodies):
            for body2 in bodies[i+1:]:
                vec = body1.position - body2.position
                gravity = (body1.mass*body2.mass/vec.magnitude) * constant * delta
                normal = vec.normalized
                body1.add_force(linear=normal.inversed*gravity, relative=False)
                body2.add_force(linear=normal*gravity, relative=False)

        world.step(delta, iterations=10)
    schedule_interval(simulate, 0.005)
    
    run()
Esempio n. 32
0
def pyglet_main(liquid):
    '''Creates a pyglet window and context that will be 4 times wider and 4 
    times taller than the simulation area. Pyglet uses asynchronous event 
    handlers so there are a few functions here to handle those events and 
    update the simulation variables. The framerate is not tied to the 
    simulation speed because the simulation is run in it's own thread and 
    pyglet is tricked into updating at 30Hz.'''

    from pyglet.window import mouse, Screen, key
    from pyglet import gl, clock, app, graphics
    import pyglet.window
    import threading
    window = pyglet.window.Window(
        width = liquid.width * 4, height = liquid.height * 4
    )
    @window.event
    def on_draw():
        '''The draw command is one glDraw command after gathering all of the 
        vertex information from the simulation. The draw loop first draws the 
        lines in simulation coordinates which is then "scaled" up using 
        glMatrixmode.'''
        window.clear()
        vertices = []
        colors = []
        for p in liquid.particles:
            vertices.extend([p.x, p.y, p.x - p.u, p.y - p.v])
            colors.extend(p.color)
            colors.extend([0, 0, 0])
        graphics.draw(
            len(liquid.particles)*2,
            gl.GL_LINES,
            ('v2f', vertices),
            ('c3B', colors)
        )
        gl.glMatrixMode(gl.GL_PROJECTION)
        gl.glLoadIdentity()
        gl.glOrtho(0, liquid.width, liquid.height, 0, -1, 1)
        gl.glMatrixMode(gl.GL_MODELVIEW)

    @window.event
    def on_mouse_press(x, y, button, modifiers):
        '''Takes mouse press coordinates and sends them to the liquid 
        simulation object.'''
        if button == mouse.LEFT:
            liquid.mouse[0] = x/4
            liquid.mouse[1] = liquid.height - y/4
            liquid.pressed = True
    
    @window.event
    def on_mouse_release(x, y, button, modifiers):
        '''Tells the liquid simulation to stop tracking the mouse.'''
        liquid.pressed = False
    
    @window.event
    def on_mouse_drag(x, y, dx, dy, button, modifiers):
        '''Updates the liquid simulation mouse coordinates.'''
        if button == mouse.LEFT:
            liquid.mouse[0] = x/4
            liquid.mouse[1] = liquid.height - y/4
            
    stop = threading.Event()
    def loop(lt, stop):
        '''This is an endless but stoppable loop to run the simulation in a
        thread while pyglet handles the drawing and mouse events.'''
        while True:
            lt.simulate()
            if stop.is_set():
                break
    
    def induce_paint(dt):
        '''This is a dummy function that is added to the pyglet schedule so 
        that the screen can be updated in a timely fashion independent of the
        simulation.'''
        pass
    
    worker = threading.Thread(target=loop, args=(liquid, stop))
    clock.schedule_interval(induce_paint, 1.0/30.0)
    worker.start()
    app.run()
    stop.set()
    worker.join()
Esempio n. 33
0
def start(subject, trial, windowN):
    """Pyglet.app in loop."""
    global start_time, trialName, subjectName
    trialName = trial
    subjectName = subject
    # window setups, esp. for fullscreen.
    display = pyglet.window.get_platform().get_default_display()
    screens = display.get_screens()
    fps_display = pyglet.clock.ClockDisplay()

    # film = makeFilm(paradigm).reverse()
    controller = pyglet.window.Window()
    windows = [pyglet.window.Window() for _ in range(windowN)]

    @controller.event
    def on_key_press(symbol, modifier):
        if symbol == key.ESCAPE or symbol == key.Q:
            # quitting in the middle way.
            # storeDataIntoFile(filmString)
            storeDataIntoFile("{startstamp},{colorname}".format(
                startstamp=time.time(), colorname="QUIT"),
                              prefix=subjectName,
                              name=trialName)

            exit(0)

    @controller.event
    def on_draw():
        global current_color_name, colormap, backgrounds
        controller.clear()
        if current_color_name == backgrounds:
            colormap['black'].blit(0, 0)
        else:
            colormap['white'].blit(0, 0)
        fps_display.draw()

    def drawer(this):
        def temp():
            global colormap, current_musk, colordictmap, backgrounds
            this.clear()
            if current_color_name != backgrounds:
                # print(current_musk)
                cf.createColorMap(colordictmap[current_color_name],
                                  current_musk).blit(0, 0)
            else:
                colormap[backgrounds].blit(0, 0)

        return temp

    for item in windows:
        item.on_draw = drawer(item)

    start_time = time.time()
    storeDataIntoFile("{startstamp},{colorname}".format(startstamp=start_time,
                                                        colorname="START"),
                      prefix=subjectName,
                      name=trialName)

    pyglet.clock.schedule(flick)
    try:
        for index in range(windowN):
            windows[index].set_fullscreen(screen=screens[index + 1])
    except IndexError:
        logger.warn("secondary screens not found.")
        pass
    # pyglet.clock.schedule(flick)
    app.run()
Esempio n. 34
0
 def play_audio_from_file(self, output_audio_file):
     song = media.load(output_audio_file)
     song.play()
     clock.schedule_once(self._end_pyglet, song.duration)
     app.run()
Esempio n. 35
0
File: demo.py Progetto: msarch/py
def main():
    app = PygletApp()
    app.run()
Esempio n. 36
0
File: demo.py Progetto: msarch/py
 def run(self):
     self.window.set_visible()
     app.run()
Esempio n. 37
0
File: state.py Progetto: kearnh/pqrs
 def start(self):
     """Should only be called once (after __init__)"""
     self._state_objects[self.state].enter('APP_START', None)
     self._state_objects[self.state].push_handlers(self.next_state)
     app.run()
Esempio n. 38
0
def main():
    #clock.schedule(update)
    load()
    app.run()
    pass
Esempio n. 39
0
 def Run(self):
     app.run()
Esempio n. 40
0
 def run(self):
     self.dispatch_event('init')
     self.dispatch_pending_events()
     self.gameWorld.init()
     app.run()
Esempio n. 41
0
 def run(self):
     app.run()
Esempio n. 42
0
 def testMultilineFalse(self):
     self.window = TestWindow(
         multiline=False, wrap_lines=False,
         msg=nonewline_nowrap, resizable=True, visible=False)
     self.window.set_visible()
     app.run()
Esempio n. 43
0
def main() -> None:
    """Create the game object and starts the event loop."""
    pong = Pong(Window(width=1024, height=768))
    pong.load()
    pong.set_screen(TitleScreen(pong))
    run()
Esempio n. 44
0
 def test(self):
     self.window = TestWindow(resizable=True, visible=False)
     self.window.set_visible()
     app.run()
Esempio n. 45
0
def game():
    app.run()
Esempio n. 46
0
def start():
    configure()
    MainWindow()
    run()
Esempio n. 47
0
 def launch(self):
     run()
Esempio n. 48
0
 def test(self):
     self.window = TestWindow(resizable=True, visible=False)
     self.window.set_visible()
     app.run()
Esempio n. 49
0
def start(bar_width, bar_color, windowN=1):
    global indicator_map, screen_size, sessionName, start_time, the_bar
    display = pyglet.window.get_platform().get_default_display()
    screens = display.get_screens()
    fps_display = pyglet.clock.ClockDisplay()

    screen_width = screens[-1].width
    screen_height = screens[-1].height

    screen_size = (screen_width, screen_height)
    indicator_map = gen.getIndicatorMap(screen_width, screen_height)
    bar_height = screen_width * 2
    the_bar = gen.getSingleBar(bar_width, int(bar_height), bar_color)

    controller = pyglet.window.Window()
    windows = [pyglet.window.Window() for _ in range(windowN)]

    @controller.event
    def on_key_press(symbol, modifier):
        "quiting sequence"
        if symbol == key.ESCAPE or symbol == key.Q:
            storeDataIntoFile(time.time(), "QUIT", name=sessionName)
            exit(0)

    @controller.event
    def on_draw():
        "stimulus monitor"
        global is_stimulus_show, indicator_map

        controller.clear()
        if is_stimulus_show:
            indicator_map['white'].blit(0, 0)
        else:
            indicator_map['black'].blit(0, 0)
        fps_display.draw()

    # player drawer
    def drawer(screen):
        def temp():
            global mapping_seq, current_idx
            global indicator_map
            global is_stimulus_show
            screen.clear()
            indicator_map["gray"].blit(0, 0)
            if is_stimulus_show:
                the_bar.draw()

        return temp

    for item in windows:
        item.on_draw = drawer(item)

    # =========================================================
    start_time = time.time()  # absolute time of starting
    storeDataIntoFile(start_time, "START", name=sessionName)

    pyglet.clock.schedule(flick)
    for index in range(windowN):
        try:
            windows[index].set_fullscreen(screen=screens[index + 1])
        except IndexError:
            windows[index].set_size(screen_width, screen_height)
            logger.warn("secondary screens not found.")

    app.run()
Esempio n. 50
0
from squiglet import Vector

win = Window()

class Ship(object):
    def __init__(self,colour):
        self.vector = Vector(colour,"ship.sgl")
        self.pos = (0,0)
    def draw(self):
        self.vector.draw(7,self.pos)

ships = [Ship((255,0,0)),Ship((0,255,0)),Ship((0,0,255))]

@win.event
def on_draw():
    win.clear()
    for ship in ships:
        ship.draw()

@win.event
def on_mouse_motion(x,y,dx,dy):
    offset = -60
    for ship in ships:
        ship.pos = (x+offset,y)
        offset+=60



app.run()
Esempio n. 51
0
File: demo.py Progetto: msarch/py
def main():
    app = PygletApp()
    app.run()
Esempio n. 52
0
"""The main entry point."""

if __name__ == '__main__':
    import logging
    from default_argparse import parser
    args = parser.parse_args()
    logging.basicConfig(stream=args.log_file, level=args.log_level)
    from version import name, version
    logging.info('Starting %s version %s.', name, version)
    from pyglet import app
    from ui import window
    logging.info('Main window: %s.', window)
    app.run()
    logging.info('Goodbye.')
Esempio n. 53
0
File: demo.py Progetto: msarch/py
 def run(self):
     self.window.set_visible()
     app.run()