@@ -32,6 +32,27 @@ def __init__(
32
32
mon_index = config .window_monitor
33
33
monitor = monitors [min (mon_index , len (monitors ) - 1 )]
34
34
35
+ size = self .parse_window_size (window_size , monitor )
36
+
37
+ super ().__init__ (size = size )
38
+
39
+ self .title = f"Manim Community { __version__ } "
40
+ self .size = size
41
+ self .renderer = renderer
42
+
43
+ mglw .activate_context (window = self )
44
+ self .timer = Timer ()
45
+ self .config = mglw .WindowConfig (ctx = self .ctx , wnd = self , timer = self .timer )
46
+ self .timer .start ()
47
+
48
+ self .swap_buffers ()
49
+
50
+ initial_position = self .find_initial_position (size , monitor )
51
+ self .position = initial_position
52
+
53
+ def parse_window_size (
54
+ self , window_size : str | tuple [int , ...], monitor : Monitor
55
+ ) -> tuple [int , int ]:
35
56
invalid_window_size_error_message = (
36
57
"window_size must be specified either as 'default', a string of the form "
37
58
"'width,height', or a tuple of 2 ints of the form (width, height)."
@@ -58,22 +79,7 @@ def __init__(
58
79
size = (window_width , window_height )
59
80
else :
60
81
raise ValueError (invalid_window_size_error_message )
61
-
62
- super ().__init__ (size = size )
63
-
64
- self .title = f"Manim Community { __version__ } "
65
- self .size = size
66
- self .renderer = renderer
67
-
68
- mglw .activate_context (window = self )
69
- self .timer = Timer ()
70
- self .config = mglw .WindowConfig (ctx = self .ctx , wnd = self , timer = self .timer )
71
- self .timer .start ()
72
-
73
- self .swap_buffers ()
74
-
75
- initial_position = self .find_initial_position (size , monitor )
76
- self .position = initial_position
82
+ return size
77
83
78
84
# Delegate event handling to scene.
79
85
def on_mouse_motion (self , x : int , y : int , dx : int , dy : int ) -> None :
0 commit comments