You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the opened issues and there are no duplicates
Describe the bug
If you try to update the image source (src_base64) of an Image control too many times from a different thread, the update won't work properly and the socket connection may even break. The image is only updated from time to time because too many updates are sent to the component. If the update calls are limited (not every 2-5ms) it seems to work.
In my opinion this could be a locking problem with the update method or a buffer problem.
The error occurred when implementing a live webcam view using opencv-python. If there is a better solution for displaying a stream of realtime processed numpy arrays, I would be happy to know about it as well.
Please install numpy and opencv-python as dependencies.
pip install numpy opencv-python
Run the example and see that the image is not updated correctly (one update per update call). You can uncomment the time.sleep call and see that it works better with a bit of sleep.
Expected behavior
The frames are either displayed or skipped, but not been shown delayed.
Screenshots / Videos
Capturesimage-control-real-time.mp4
Without time.sleep.
image-control-with-sleep.mov
With time.sleep enabled.
Operating System
macOS
Operating system details
MacOS 15.0.1
Flet version
0.24.1
Regression
I'm not sure / I don't know
Suggestions
As mentioned above, it appears that the page.update() method can be called multiple times, but internally passes the work to another thread. This causes either a concurrency problem or a buffer fill.
Duplicate Check
Describe the bug
If you try to update the image source (
src_base64
) of anImage
control too many times from a different thread, the update won't work properly and the socket connection may even break. The image is only updated from time to time because too many updates are sent to the component. If the update calls are limited (not every 2-5ms) it seems to work.In my opinion this could be a locking problem with the update method or a buffer problem.
The error occurred when implementing a live webcam view using opencv-python. If there is a better solution for displaying a stream of realtime processed numpy arrays, I would be happy to know about it as well.
Code sample
Code
To reproduce
Please install
numpy
andopencv-python
as dependencies.Run the example and see that the image is not updated correctly (one update per update call). You can uncomment the
time.sleep
call and see that it works better with a bit of sleep.Expected behavior
The frames are either displayed or skipped, but not been shown delayed.
Screenshots / Videos
Captures
image-control-real-time.mp4
Without
time.sleep
.image-control-with-sleep.mov
With
time.sleep
enabled.Operating System
macOS
Operating system details
MacOS 15.0.1
Flet version
0.24.1
Regression
I'm not sure / I don't know
Suggestions
As mentioned above, it appears that the
page.update()
method can be called multiple times, but internally passes the work to another thread. This causes either a concurrency problem or a buffer fill.Logs
Logs
Additional details
No response
The text was updated successfully, but these errors were encountered: