obsws-python
obsws-python copied to clipboard
Setting text and retrieving transform data for text results in stale transform data
In Python, I am working on some code that changes text in OBS and then centers the text element.
Here is the relevant code:
# OBS_REQUEST_CLIENT, TEXT_SOURCE_NAME, text_item_id, and text are all assigned before this point
OBS_REQUEST_CLIENT.set_input_settings(TEXT_SOURCE_NAME, {"text": text}, True)
text_item_transform = OBS_REQUEST_CLIENT.get_scene_item_transform("Scene", text_item_id).scene_item_transform
text_item_width = text_item_transform["sourceWidth"]
text_item_height = text_item_transform["sourceHeight"]
OBS_REQUEST_CLIENT.set_scene_item_transform(
"Scene",
text_item_id,
{
"scaleX": 1.0,
"scaleY": 1.0,
"positionX": (SCENE_WIDTH - text_item_width) / 2,
"positionY": (SCENE_HEIGHT - text_item_height) / 2,
}
)
However, having these two calls one after the other often results in stale data for the text item's width and height. I have to put a sleep(0.1)
call after the call to OBS_REQUEST_CLIENT.set_input_settings(...)
to prevent this. This does not seem like expected behavior unless I am mistaken.
Something like CodingRooms https://codingrooms.com/ "real-time student dashboard" would be amazing. It does not need to be as feature rich as this either. To just see student code by displaying the history logs in a grid style view.