0

I am using PyQt5 and now that I am overriding the keyPressEvent method, any button click using the same method in my class will only update the screen if the user clicks away. Using the keyboard works fine as intended. Does anyone know what could cause this?

Some code to show:


    def keyPressEvent(self, event):
        LEFT_KEY = 16777234
        RIGHT_KEY = 16777236
        if (event.key() == LEFT_KEY):
            self.previous()
        elif (event.key() == RIGHT_KEY):
            self.next()

Button clicks calling self.previous and self.next are not working until the user clicks off the program (hiding the window) and clicks on again.

Ben Dent
  • 41
  • 7

2 Answers2

0

Use mousePressEvent to catch mouse event.

Grzegorz Bokota
  • 1,736
  • 11
  • 19
0

I've found a way to solve this - Pyinstaller and PyQt5 macOS Mojave compatibility issues

Looks like was an issue with my OS so needed to use the repaint method

Ben Dent
  • 41
  • 7