I am tring to understand MVC design pattern but using timers in the design is a little bit confusing.
I have an application that show the webcam on a gui. The model contains the webcam logic (initialize, get_frame ecc) The view contains the widgets (I am using PyQt but the framework is not the problem here) that show the image.
I am using a timer (Qt timer) to call update_frame
every 1/30 s. update_frame
calls model.get_frame
to get the new image.
Should the timer belonging to the view ? What if get_frame
waits the image to be ready ( like a blocking function ) and I want to update the image as soon as a new image is ready ? Where do I put the infinite loop ?
Aucun commentaire:
Enregistrer un commentaire