Create a Viewport Popup Notification

If you want to provide a notification message to a user that would be difficult to miss or to prompt a response from the user, you can use the Notification Manager Extension (omni.kit.notification_manager) . This extension creates popup or toast notifications in the viewport.

from omni.kit.notification_manager import post_notification, NotificationStatus

post_notification("Notification 1, default duration")
post_notification("Notification 2, with 1 second duration", duration=1)
post_notification("Notification 4 (warning), with 4 second duration", duration=4, status=NotificationStatus.WARNING)

You can optionally add buttons to the notification to prompt the user to take an action in regards to the notification.

import omni.kit.notification_manager as nm

def clicked_ok():
    print("User clicked ok")

def clicked_cancel():
    print("User clicked cancel")

ok_button = nm.NotificationButtonInfo("OK", on_complete=clicked_ok)
cancel_button = nm.NotificationButtonInfo("CANCEL", on_complete=clicked_cancel)
notification_info = nm.post_notification(
    "Notification Example",
    hide_after_timeout=False,
    duration=0,
    status=nm.NotificationStatus.WARNING,
    button_infos=[ok_button, cancel_button],
)