I am using PYQT5 and APScheduler lib to handle some functions: turn on, off camera at specific time. This is error i got:
QObject::killTimer: Timers cannot be stopped from another thread
QObject::startTimer: Timers cannot be started from another thread
My camera stopped but not start and I am not sure how to fix them. Pls help me
MainWindow:
class MainWindow(QWidget): # class constructor def __init__(self): # call QWidget constructor super().__init__() self.ui = Ui_Form() self.ui.setupUi(self) # create a timer self.timer = QTimer() self.sch = Scheduler() self.sch.add(self.start_webcam) self.sch.start() def start_webcam(self): # # set timer timeout callback function self.timer.timeout.connect(self.update_frame) self.timer.start(5) ```Schedule:
class Scheduler(QtCore.QObject): def __init__(self): super().__init__() self.sched = QtScheduler() def add(self, job_function): trigger_on = CronTrigger( year="*", month="*", day="*", hour="10", minute="53", second="0" ) self.sched.add_job(job_function, trigger=trigger_on,) def start(self): self.sched.start()