title: PyQt5 store time of keyPressEvent
body: <p><strong>Issue:</strong></p>
  <p>I have a program where I will be showing several pages with a stacked widget, and users will have to press a button (using code I've written below) to go to the next page of the stacked widget. What I am trying to do is to calculate the time the reaction time of the user. So to measure how quick they were to press a button.</p>
  <p><strong>Possible solution:</strong></p>
  <p>I was thinking of storing the time that a key was pressed (point B) and the time that the page was shown (point A) and to subtract these points to get the reaction time. I was thinking of using a QTimer running throughout all the pages and whenever a key is pressed, it will store the time in a variable (that would be point b). And store the time that the page was shown (point a), and subtract these points to get the reaction time. <em>However, I am quite a beginner in coding and don't know how I would code this. Or whether there is a simpler way.</em></p>
  <p>The second solution I thought of was to used QElapsedTimer, <em>but I don't know how to code that either.</em></p>
  <p><strong>Button press:</strong></p>
  <p>I have also created a subclass of a QWidget that will emit a signal every time I press the key 'F' or 'J' (KeybaordWidget). So I was thinking, I would need to write a function that does what I have described and connect that function to the 'fPress' or 'jPress' signal.</p>
  <pre><code>class KeyboardWidget (QWidget):
      fPress = pyqtSignal(str)
      jPress = pyqtSignal(str)
      def keyPressEvent(self,event):
          if event.key() == Qt.Key_F:
              self.fPress.emit('f')
          elif event.key() == Qt.Key_J:
              self.jPress.emit ('j')
  </code></pre>