Here’s the issue:
I have a DirectOptionMenu for selecting a usb webcam. Since those can be plugged in and out, the list on the DirectOptionMenu has to be updated with a task, even if not necessarily every frame and when the mouse cursor is not on the DirectOptionMenu.
The issue is, when the user selects one webcam and the above task to update the list is constantly running, the current item of the DirectOptionMenu which is selected jumps to the first one in the visible list and not necessarily the currently (last) selected one by the user. So the name of the camera displayed by Panda and one currently in use do not match.
If I do DirectOptionMenu.set(index) to set the correct name in the GUI in the task, the function to set the camera stream is also called, and since it is a task, the camera (OpenCV VideoStream) is constantly updated with the same camera, essentially freezing the program. I couldn’t find a way to do set() without the DirectOptionMenu assigned command being called.
Is there a way to set the current item in the list without using set() which also calls the function assigned to the command of DirectOptionMenu?
Sure, a flag variable could be used to make sure the task doesn’t set the camera input more than once but that feels like a bandaid solution and I’m sure DirectOptionMenu has a better way of handling a situation where the list of items are constantly updated without the user wanting the currently selected item to be reset to the first one.