Extension: omni.kit.clipboard-1.1.0 |
Documentation Generated: Aug 12, 2025 |
Usage Examples#
Copy String to Clipboard#
from omni.kit.clipboard import copy
# Copy a string into the system clipboard
text_to_copy = "Hello, Clipboard!"
copy(text_to_copy)
Paste String from Clipboard#
from omni.kit.clipboard import paste
# Paste a string from the system clipboard
pasted_text = paste()
print(f"Text pasted from clipboard: '{pasted_text}'")
Event Registration#
from omni.kit.clipboard import GLOBAL_EVENT_CLIPBOARD
from carb.eventdispatcher import get_eventdispatcher
def on_event(e):
print(f"Data pasted to clipboard! contents='{e['contents']}'")
# Sub must be retained to keep the subscription active
sub = get_eventdispatcher().observe_event(
event_name=GLOBAL_EVENT_CLIPBOARD,
on_event=on_event
)