From 8db7756d2e5706df7ca7377f106d0452d91d8203 Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Thu, 13 Feb 2020 10:50:38 -0800 Subject: [PATCH] A little more window initialization --- manimlib/window.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/manimlib/window.py b/manimlib/window.py index fcb4b227..7e9ac290 100644 --- a/manimlib/window.py +++ b/manimlib/window.py @@ -1,26 +1,33 @@ import moderngl_window as mglw from moderngl_window.context.pyglet.window import Window as PygletWindow +from moderngl_window.timers.clock import Timer from manimlib.constants import DEFAULT_PIXEL_WIDTH from manimlib.constants import DEFAULT_PIXEL_HEIGHT +from manimlib.utils.config_ops import digest_config class Window(PygletWindow): - title = "" size = (DEFAULT_PIXEL_WIDTH, DEFAULT_PIXEL_HEIGHT) fullscreen = False resizable = True gl_version = (3, 3) - aspect_ratio = None vsync = True samples = 1 cursor = True def __init__(self, scene, **kwargs): + digest_config(self, kwargs) super().__init__(**kwargs) self.scene = scene - # self.print_context_info() + 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() # Delegate event handling to scene def pixel_coords_to_space_coords(self, px, py, relative=False):