Omniverse Create and Qt

I’ve confirmed that we don’t currently support this.

I thought I’d offer a potential solution for the blocked UI issue that you ran into. You can’t call QApplication.exec_()because it blocks Create’s UI thread. Instead, you need to let Create drive the Qt updates by hooking into Create’s event loop.

import carb.events
import omni.kit.app

from PySide2.QtCore import QSize, Qt
from PySide2.QtWidgets import QApplication, QMainWindow, QPushButton

update_stream = omni.kit.app.get_app().get_update_event_stream()


class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()
        button = QPushButton("Press Me!")
        button.clicked.connect(self.button_clicked)
        self.setCentralWidget(button)
        
    def button_clicked(self):
        print("Clicked!")

try:
    app = QApplication([])
except:
    app = QApplication.instance()

window = MainWindow()
window.show()

def on_update(e: carb.events.IEvent):
    app.processEvents()

sub = update_stream.create_subscription_to_pop(on_update, name="My Subscription Name")
2 Likes