I have a Python PyQt program which has a QWidget on the main window.
I added 2 different views into the same QWidget.
When the user clicks Button1, I show view1 and hide view2.
When the user clicks Button2, I show view2 and hide view1.
Each view has its own KeyPressEvent for using arrow keys to page through records in the view.
I don't want to page through records in both views simultaneously, I just need to page the records of the active view.
How can I disable/enable the appropriate KeyPressEvent when the corresponding view is active.  Or is the a better approach? 
Apologies for no code, but it is difficult to simplify my working example.
If you setFocus on an object in the corresponding view that was just made visible, then only that view's keyPressEvent will be triggered.  No need to disable or enable keypress events.  The focus does this automatically.
The solution above is the answer to the question.  However, I may change from using QAction buttons to trigger changing the views, to using a tabwidget to change the views instead.
PyQt: Independent KeyPressEvent between 2 different views on a form