mirror of
https://github.com/3b1b/manim.git
synced 2025-04-13 09:47:07 +00:00
Call Window.init_mgl_context and reorder Window.__init__
This commit is contained in:
parent
6e2dcae4d7
commit
1798875396
2 changed files with 9 additions and 6 deletions
|
@ -8,6 +8,7 @@ from functools import wraps
|
|||
from tqdm import tqdm as ProgressDisplay
|
||||
import numpy as np
|
||||
import time
|
||||
import moderngl
|
||||
from IPython.terminal.embed import InteractiveShellEmbed
|
||||
|
||||
from manimlib.animation.animation import prepare_animation
|
||||
|
@ -44,7 +45,7 @@ class Scene(object):
|
|||
def __init__(self, **kwargs):
|
||||
digest_config(self, kwargs)
|
||||
if self.preview:
|
||||
self.window = Window(self, **self.window_config)
|
||||
self.window = Window(scene=self, **self.window_config)
|
||||
self.camera_config["ctx"] = self.window.ctx
|
||||
else:
|
||||
self.window = None
|
||||
|
|
|
@ -17,6 +17,13 @@ class Window(PygletWindow):
|
|||
def __init__(self, scene, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
digest_config(self, kwargs)
|
||||
|
||||
self.init_mgl_context()
|
||||
mglw.activate_context(window=self)
|
||||
self.timer = Timer()
|
||||
self.config = mglw.WindowConfig(ctx=self.ctx, wnd=self, timer=self.timer)
|
||||
self.timer.start()
|
||||
|
||||
self.scene = scene
|
||||
self.title = str(scene)
|
||||
self.pressed_keys = set()
|
||||
|
@ -31,11 +38,6 @@ class Window(PygletWindow):
|
|||
if "size" in kwargs:
|
||||
self.size = kwargs["size"]
|
||||
|
||||
mglw.activate_context(window=self)
|
||||
self.timer = Timer()
|
||||
self.config = mglw.WindowConfig(ctx=self.ctx, wnd=self, timer=self.timer)
|
||||
self.timer.start()
|
||||
|
||||
def find_initial_position(self):
|
||||
custom_position = get_customization()["window_position"]
|
||||
monitor = get_monitors()[get_customization()["window_monitor"]]
|
||||
|
|
Loading…
Add table
Reference in a new issue