Esempio n. 1
0
    def __init__(self,
                 scene: Scene,
                 size: tuple[int, int] = (1280, 720),
                 **kwargs):
        super().__init__(size=size)
        digest_config(self, kwargs)

        self.scene = scene
        self.pressed_keys = set()
        self.title = str(scene)
        self.size = size

        mglw.activate_context(window=self)
        self.timer = Timer()
        self.config = mglw.WindowConfig(ctx=self.ctx,
                                        wnd=self,
                                        timer=self.timer)
        self.timer.start()

        # No idea why, but when self.position is set once
        # it sometimes doesn't actually change the position
        # to the specified tuple on the rhs, but doing it
        # twice seems to make it work.  ¯\_(ツ)_/¯
        initial_position = self.find_initial_position(size)
        self.position = initial_position
        self.position = initial_position
    def __init__(self, renderer, size=None, **kwargs):
        if size is None:
            # Default to making window half the screen size
            # but make it full screen if --fullscreen is passed in
            monitors = get_monitors()
            mon_index = config.window_monitor
            monitor = monitors[min(mon_index, len(monitors) - 1)]
            window_width = monitor.width

            if not config.fullscreen:
                window_width //= 2

            window_height = int(window_width * config.frame_height //
                                config.frame_width)
            size = (window_width, window_height)

        super().__init__(size=size)

        self.title = f"Manim Community {__version__}"
        self.size = size
        self.renderer = renderer

        mglw.activate_context(window=self)
        self.timer = Timer()
        self.config = mglw.WindowConfig(ctx=self.ctx,
                                        wnd=self,
                                        timer=self.timer)
        self.timer.start()

        self.swap_buffers()

        initial_position = self.find_initial_position(size, monitor)
        self.position = initial_position
Esempio n. 3
0
    def __init__(self, scene, **kwargs):
        super().__init__(**kwargs)
        digest_config(self, kwargs)
        self.scene = scene
        self.title = str(scene)
        self.pressed_keys = set()
        self.position = self.find_initial_position()

        mglw.activate_context(window=self)
        self.timer = Timer()
        self.config = mglw.WindowConfig(ctx=self.ctx, wnd=self, timer=self.timer)
        self.timer.start()
Esempio n. 4
0
    def __init__(self, scene, **kwargs):
        digest_config(self, kwargs)
        super().__init__(**kwargs)
        self.scene = scene
        self.title = str(scene)
        # Put at the top of the screen
        self.position = (self.position[0], 0)

        mglw.activate_context(window=self)
        self.timer = Timer()
        self.config = mglw.WindowConfig(ctx=self.ctx,
                                        wnd=self,
                                        timer=self.timer)
        self.timer.start()
    def __init__(self, renderer, size=None, **kwargs):
        if size is None:
            size = (config["pixel_width"], config["pixel_height"])
        super().__init__(size=size)

        self.title = f"Manim Community {__version__}"
        self.size = size
        self.renderer = renderer

        mglw.activate_context(window=self)
        self.timer = Timer()
        self.config = mglw.WindowConfig(ctx=self.ctx,
                                        wnd=self,
                                        timer=self.timer)
        self.timer.start()

        self.swap_buffers()
Esempio n. 6
0
    def __init__(self, renderer, size=config.window_size, **kwargs):
        monitors = get_monitors()
        mon_index = config.window_monitor
        monitor = monitors[min(mon_index, len(monitors) - 1)]

        if size == "default":
            # make window_width half the width of the monitor
            # but make it full screen if --fullscreen

            window_width = monitor.width
            if not config.fullscreen:
                window_width //= 2

            #  by default window_height = 9/16 * window_width
            window_height = int(
                window_width * config.frame_height // config.frame_width, )
            size = (window_width, window_height)
        else:
            size = tuple(size)

        super().__init__(size=size)

        self.title = f"Manim Community {__version__}"
        self.size = size
        self.renderer = renderer

        mglw.activate_context(window=self)
        self.timer = Timer()
        self.config = mglw.WindowConfig(ctx=self.ctx,
                                        wnd=self,
                                        timer=self.timer)
        self.timer.start()

        self.swap_buffers()

        initial_position = self.find_initial_position(size, monitor)
        self.position = initial_position