python2.7為什麼點擊了"開始"按鈕後,tkinter上的按鈕,圖中紅色部分,再也點不動了?
漂亮男人
漂亮男人 2017-05-27 17:39:55
0
1
784

python2.7為什麼點擊了"開始"按鈕後,tkinter上的按鈕,圖中紅色部分,再也點不動了?如何能在點擊"開始"按鈕後,還能點擊tkinter的最小化,最大化和關閉按鈕?
程式碼為:

# -*- 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()

#
漂亮男人
漂亮男人

全部回覆(1)
大家讲道理

因為你在start裡面寫的是死循環,永遠不會結束
你應該新啟一個子線程才對

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!