Trigger UI event in Create from the background thread

Is there a correct way to trigger some action on UI thread?
I have a Create’s py extension where I have a timer event that I enqueue using threading.Timer. I detected that timer’s handler is called within a thread other than the main thread (I’ve compared values returned by threading.current_thread().ident ).
My timer’s handler does some UI stuff and Create’s UI get frozen.
When I trigger same action on button click in Create’s extension - all is ok.
Please help.

Hi @Mykola-777. We don’t have a lot of examples where use with threading with UI updates. I would try to stick with coroutines if possible as that pattern is much more common in our code base. If you do need threads, I found a couple of examples in these extensions:

  • omni.isaac.onshape
  • omni.kit.window.audioplayer

Have a look at those. If you want to share some code, I can look to see if I can spot any problems.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.