| Extension: omni.kit.widget.viewport-107.0.8 | Documentation Generated: Mar 20, 2025 | 
Overview#
Introduction#
A low level implementation of an omni.ui.Widget that displays rendered output.
The omni.kit.widget.viewport.ViewportWidget does not include any additional features (such as menu-items or
manipulators).  It is used by omni.kit.viewport.window.ViewportWindow to provide a higher level, default Viewport
experience in Kit based apps.
How to create a new ViewportWidget#
Python#
- Import - omni.uiso the- ViewportWidgetcan be created inside an- omni.ui.Window
import omni.ui as ui
- Import the class from the package: 
from omni.kit.widget.viewport import ViewportWidget
- Choose the resolution and camera this instance will start rendering with. 
resolution=(512, 512)
camera_path="/OmniverseKit_Persp"
- Create an empty - omni.ui.Windowand instantiate a new- ViewportWidgetin its- omni.ui.Frame
window = ui.Window("Demo ViewportWidget", width=resolution[0], height=resolution[1])
with window.frame:
  vp_widget = ViewportWidget(camera_path=camera_path, resolution=resolution)
- Get the active ViewportAPI attached to the - ViewportWidgetand inspect some properties.
viewport_api = vp_widget.viewport_api
usd_context = viewport_api.usd_context
usd_context_name = viewport_api.usd_context_name
usd_stage = viewport_api.stage
camera_path = viewport_api.camera_path
resolution = viewport_api.resolution