Why can't the button on tkinter, the red part in the picture, be clicked after clicking the "Start" button in python2.7?
漂亮男人
漂亮男人 2017-05-27 17:39:55
0
1
732

python2.7 Why can’t I click the button on tkinter, the red part in the picture, after clicking the "Start" button? How can I click the minimize, maximize and close buttons of tkinter after clicking the "Start" button?
The code is:

# -*- coding: UTF-8 -*- from Tkinter import * import os import tkMessageBox import time root = Tk() today_path = time.strftime('%Y-%m-%d') work_path = 'C:\yes_pic\' + today_path def start(): while True: doThis(work_path) time.sleep(5) def doThis(dirr): if not os.path.exists(dirr): pass else: if os.path.isdir(dirr): for p in os.listdir(dirr): d = os.path.join(dirr,p) if (os.path.isdir(d) == True): doThis(d) if os.listdir(dirr): if dirr.count('\')!=2: tkMessageBox.showwarning("提示", "路径"+dirr+"有文件!") button = Button(root, text="开始", command=start,width=20,height=10) button.pack() root.geometry('300x200+500+300') root.mainloop()

漂亮男人
漂亮男人

reply all (1)
大家讲道理

Because what you wrote in start is an infinite loop that will never end
You should start a new sub-thread

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!