我想使用tkinter为我的代码添加开始和停止按钮我只希望当我单击scheduler.start()的开始按钮时,代码将运行当我单击scheduler.shutdown()的停止按钮时,代码将停止它是一个[[Python 2.7版本,但是不用担心,我只需要这段代码的想法,它将如何运行这是我的代码:
if __name__ == '__main__':
logging.basicConfig(filename='read.log', level=logging.INFO)
logging.getLogger('apscheduler').setLevel(logging.DEBUG)
scheduler = BackgroundScheduler()
scheduler.add_job(calstk, 'interval', seconds=20)
# scheduler.add_job(calmrp, 'interval', seconds=10)
# scheduler.add_job(caldisc, 'interval', seconds=15)
# leave space only for understanding for which I need to add **start Button**
scheduler.start() # for this scheduler.start()
print('Press Ctrl+{0} to exit'.format('Break' if os.name == 'nt' else 'C'))
try:
# stock = calstk()
#print stock
print '************************************************************************************'
# This is here to simulate application activity (which keeps the main thread alive).
while True:
time.sleep(10)
except (KeyboardInterrupt, SystemExit):
# Not strictly necessary if daemonic mode is enabled but should be done if possible
pass
# leave space only for understanding for which I need to add **Stop Button**
scheduler.shutdown()
# for this scheduler.shutdown()
我想为的停止按钮。我确实需要此代码,几乎可以构建我的项目,并且只需要这两个Button即可处理我的项目。[我想使用tkinter为代码添加启动和停止按钮,我只希望当我单击scheduler.start()的开始按钮时代码将运行,而当我单击调度器的停止按钮时...。scheduler.start()]添加开始按钮>和<< scheduler.shutdown()