Subclassing managers.WindowManager
As discussed in Chapter 2, Handling Cameras, Files and GUIs, our object-oriented design allows us to easily swap OpenCV's HighGUI window manager for another window manager, such as Pygame. To do so, we just need to subclass our managers.WindowManager class
and override four methods: createWindow(), show(), destroyWindow(), and processEvents(). Also, we need to import some new dependencies.
To proceed, we need the managers.py file from Chapter 2, Handling Cameras, Files, and GUIs and the utils.py file from Chapter 4, Tracking Faces with Haar Cascades. From utils.py, we only need one function,
isGray(), which we implemented in Chapter 4, Tracking Faces with Haar Cascades. Let's edit managers.py to add the following ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access