'How to figure out whether button is continuosly pressed or not in PyQt5?

For my application, I need my lift system to go up as long as the button is pressed and it should stop when I don't press the button.

clicked() function is not functional for this purpose. However pressed() and released() functions also didn't work.

I snipped related section of my code below. My aim is to print "Pressed" text as long as button is pressed

def __init__(self):
    manual_button = QPushButton('Lift Button')
    manual_button.pressed.connect(press_function)
    self.manual_grid.addWidget(manual_button, 0, 1)

def press_function(self):
    print('pressed')

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source