单击后按钮挂起,并且不显示在其上创建的新按钮

时间:2018-06-19 20:38:47

标签: tkinter python-multithreading

我正在尝试使用tkinter在GUI上计划任务并显示倒数计时器,但是在单击“计划”按钮时,按钮挂起并且不显示倒数,并且一段时间后,我看到“超过了最大递归深度”

def schedule_button = tk.Button(checkbox_pane.canvas, text="Schedule",
                           command=lambda:countdonw_time(timestamp), width=15,height=1)
     checkbox_pane.canvas.create_window(300, 430, window=schedule_button)

def countdonw_time(timestamp):
    setup_timer = tk.Label(checkbox_pane.canvas, text='Test run scheduled at: %s' %timestamp, width=80, height=10)
    pane1 = checkbox_pane.canvas.create_window(300, 430, window=setup_timer)
    schedule_display(remainingtime_new)

def schedule_display(remainintime_new):
    remainingtime_new = 0
    if remainingtime is not None:
        remainingtime_new = remainingtime
    if remainingtime_new <=0:
        pass
        # setup_timer.configure(text = "timeup")
    else:
        remainingtime_new = remainingtime_new - 1
        time.sleep(1)
        root.after(1000,schedule_display(remainingtime_new)

并非在此指定我传递的所有参数。我谷歌搜索,发现我可以使用线程,但是我不确定如何使用它们。任何帮助表示赞赏。

0 个答案:

没有答案