H
H
hardwellZero2015-02-05 13:50:29
Python
hardwellZero, 2015-02-05 13:50:29

How to make it run?

def buttonGo(self):
        self.statusBar().showMessage('In progress...')
        scheduler = BackgroundScheduler()
        scheduler.add_job(tick(self), 'interval', seconds=3)
        scheduler.start()

        try:
            # This is here to simulate application activity (which keeps the main thread alive).
            while True:
                time.sleep(2)
        except (KeyboardInterrupt, SystemExit):
            scheduler.shutdown()  # Not strictly necessary if daemonic mode is enabled but should be done if possible

def tick(self):
    print "test"

Outputs only 1 time and throws an error -
TypeError: func must be a callable or a textual reference to one

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question