def click(self, x, y, button, press):
    """Print Fibonacci numbers when the left click is pressed."""
if button == 1:
    if press:
        print(next(self.fibo))
else:
    self.stop()
C = Clickonacci()
C.run()
How to detect mouse click in python 3 on linux?