def METHOD_NAME(self):
    # This is NOT the UI thread, need to call post_to_main_thread() to update
    # the scene or any part of the UI.
    idx = 0
    while not self.is_done:
        time.sleep(0.100)
        # Get the next frame, for instance, reading a frame from the camera.
        rgb_frame = self.rgb_images[idx]
        depth_frame = self.depth_images[idx]
        idx += 1
        if idx >= len(self.rgb_images):
            idx = 0
        # Update the images. This must be done on the UI thread.
        def update():
            self.rgb_widget.update_image(rgb_frame)
            self.depth_widget.update_image(depth_frame)
            self.widget3d.scene.set_background([1, 1, 1, 1], rgb_frame)
        if not self.is_done:
            gui.Application.instance.post_to_main_thread(
                self.window, update)