示例#1
0
    def testMSequencePygletSprite(self):
        #window = PygletController(fullscreen=True, show_fps=True)
        #screen = ScreenDescriptor.create(window.width, window.height)
        #app = App()
        #window.set_app(app)
        #fs = FlickeringPygletSprite.create_flickering_checkered_box_sprite(BasicModel(), screen, SpritePositionComputer.North)
        #window.add_view(fs)
        #window.switch_to()
        #window.start()
        #window.clear()
        #window.close()
        #

        window = PygletWindow(fullscreen=False, show_fps=True)
        canvas = Canvas.create(window.width, window.height)

        fs = FlickeringPygletSprite.create_flickering_checkered_box_sprite(
            AlternatingBinaryStateModel(hold_duration=5),
            canvas,
            SpritePositionComputer.North,
            width=200,
            height=200,
            xfreq=4,
            yfreq=4)

        fs1 = FlickeringPygletSprite.create_flickering_checkered_box_sprite(
            AlternatingBinaryStateModel(hold_duration=5),
            canvas,
            SpritePositionComputer.East,
            90,
            width=200,
            height=200,
            xfreq=4,
            yfreq=4)

        fs2 = FlickeringPygletSprite.create_flickering_checkered_box_sprite(
            AlternatingBinaryStateModel(hold_duration=5),
            canvas,
            SpritePositionComputer.South,
            width=200,
            height=200,
            xfreq=4,
            yfreq=4)

        fs3 = FlickeringPygletSprite.create_flickering_checkered_box_sprite(
            AlternatingBinaryStateModel(hold_duration=5),
            canvas,
            SpritePositionComputer.West,
            90,
            width=200,
            height=200,
            xfreq=4,
            yfreq=4)
        controller = UnlockController(window, [fs, fs1, fs2, fs3], canvas)
        controller.make_active()
        window.switch_to()
        window.start()
        window.close()
示例#2
0
 def testPygletText(self):
     window = PygletWindow(fullscreen=False, show_fps=True)
     canvas = Canvas.create(window.width, window.height)
     model = AlternatingBinaryStateModel()
     pos = PositionMixin()
     text_label = PygletTextLabel(model, canvas, 'the text',
                                  canvas.width / 2.0, canvas.height / 2.0)
     bell_ring_text_label_decorator = BellRingTextLabelDecorator(text_label)
     controller = UnlockController(window, [bell_ring_text_label_decorator],
                                   canvas)
     controller.make_active()
     window.start()
     window.close()