mirror of
https://github.com/3b1b/manim.git
synced 2025-07-27 20:12:24 +08:00
make window_position changeable
This commit is contained in:
@ -29,6 +29,10 @@ universal_import_line: "from manimlib.imports import *"
|
|||||||
style:
|
style:
|
||||||
font: "Consolas"
|
font: "Consolas"
|
||||||
background_color: "#333333"
|
background_color: "#333333"
|
||||||
|
# Set the position of preview window, you can use directions, e.g. UL/DR/OL/OO/...
|
||||||
|
# also, you can also specify the position(pixel) of the upper left corner of
|
||||||
|
# the window on the monitor, e.g. "960,540"
|
||||||
|
window_position: UR
|
||||||
camera_qualities:
|
camera_qualities:
|
||||||
low:
|
low:
|
||||||
resolution: "854x480"
|
resolution: "854x480"
|
||||||
|
@ -203,7 +203,23 @@ def get_configuration(args):
|
|||||||
else:
|
else:
|
||||||
window_width = monitor.width / 2
|
window_width = monitor.width / 2
|
||||||
window_height = window_width * 9 / 16
|
window_height = window_width * 9 / 16
|
||||||
window_position = (int(monitor.width - window_width), 0)
|
custom_position = custom_defaults["window_position"]
|
||||||
|
if "," in custom_position:
|
||||||
|
posx, posy = map(int, custom_position.split(","))
|
||||||
|
else:
|
||||||
|
if custom_position[1] == "L":
|
||||||
|
posx = 0
|
||||||
|
elif custom_position[1] == "O":
|
||||||
|
posx = int((monitor.width - window_width) / 2)
|
||||||
|
elif custom_position[1] == "R":
|
||||||
|
posx = int(monitor.width - window_width)
|
||||||
|
if custom_position[0] == "U":
|
||||||
|
posy = 0
|
||||||
|
elif custom_position[0] == "O":
|
||||||
|
posy = int((monitor.height - window_height) / 2)
|
||||||
|
elif custom_position[0] == "D":
|
||||||
|
posy = int(monitor.height - window_height)
|
||||||
|
window_position = (posx, posy)
|
||||||
config["window_config"] = {
|
config["window_config"] = {
|
||||||
"size": (window_width, window_height),
|
"size": (window_width, window_height),
|
||||||
"position": window_position,
|
"position": window_position,
|
||||||
|
Reference in New Issue
Block a user