python2.7為什么點擊了"開始"按鈕后,tkinter上的按鈕,圖中紅色部分,再也點不動了?如何能在點擊"開始"按鈕后,還能點擊tkinter的最小化,最大化和關(guān)閉按鈕?
代碼為:
# -*- 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()
微信掃碼
關(guān)注PHP中文網(wǎng)服務號
QQ掃碼
加入技術(shù)交流群
Copyright 2014-2025 http://m.miracleart.cn/ All Rights Reserved | php.cn | 湘ICP備2023035733號