from __future__ import annotations
from typing import Union
from ovito.pipeline import Pipeline
from ovito.vis import Viewport
import ovito

# Implementation of the legacy ovito.gui.create_window() function.
# For backward compatibility with OVITO 3.15.5.
def create_window(contents: Union[Pipeline, Viewport, None] = None) -> ovito.gui.MainWindow:
    mainWin = ovito.gui.MainWindow(contents)
    return mainWin.widget
ovito.gui.create_window = create_window