使用pyinstaller构建tkinter时,BlockingScheduler无法正常工作

时间:2017-04-08 15:26:15

标签: python tkinter scheduler pyinstaller

我有一个tkinter python脚本,它在定义的时间提醒我。一切正常。现在我想通过pyinstaller使这个应用程序可执行。当我运行 pyinstaller filename.py 时,它还会创建所有依赖项文件。但是,单击 .exe 文件无法正常/打开我的应用程序。提到你我使用的是ubuntu 16.1。以下是我的代码。

import time
from apscheduler.schedulers.blocking import BlockingScheduler
import logging
import urlparse
import urllib
import urllib2
import simplejson
from Tkinter import *



logging.basicConfig()

def auto_timer():
    global time, urllib2, simplejson
    today_date = time.strftime("%Y-%m-%d")

    response = urllib2.urlopen("http://localhost/tk_dev/index.php/json/python_tkinter_effort_notice/118")
    data = simplejson.load(response)
    data_status = data["ma_effort_date"]  # 2017-02-19


    global root100
    root100 = Tk()


    if data_status != today_date:
        root100.attributes('-zoomed', True)
        root100.title("Notification")
        label = Label(root100, width="100",  text="Your didn't effort today. \nTime to do this job now. . . \nHurry up!!!")
        label.pack(side="top", fill="both", expand=True, padx=20, pady=20)

        button = Button(text = 'Close')
        button.pack(side="bottom", fill="none", expand=True)

        root100.mainloop()




not_executed = 1

while(not_executed):
    dt = list(time.localtime())
    hour = dt[3]
    minute = dt[4]


    if hour == 20 and minute == 40:
        scheduler = BlockingScheduler()
        scheduler.add_job(auto_timer, 'interval', hours=0.002)
        scheduler.start()
        not_executed = 0

0 个答案:

没有答案