久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術文章
文章詳情頁

python2.7為什么點擊了"開始"按鈕后,tkinter上的按鈕,圖中紅色部分,再也點不動了?

瀏覽:200日期:2022-06-29 18:51:57

問題描述

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

# -*- coding: UTF-8 -*-from Tkinter import *import osimport tkMessageBoximport timeroot = Tk()today_path = time.strftime(’%Y-%m-%d’)work_path = ’C:yes_pic’ + today_pathdef 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()

python2.7為什么點擊了"開始"按鈕后,tkinter上的按鈕,圖中紅色部分,再也點不動了?

問題解答

回答1:

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

標簽: Python 編程
主站蜘蛛池模板: 都匀市| 龙泉市| 时尚| 大洼县| 曲水县| 平顶山市| 金沙县| 巫溪县| 云南省| 陆良县| 芒康县| 惠安县| 五寨县| 城步| 广元市| 越西县| 望城县| 新绛县| 马公市| 灵宝市| 西城区| 利津县| 磴口县| 白银市| 潜山县| 囊谦县| 延吉市| 金门县| 红安县| 米林县| 台南市| 含山县| 龙口市| 绍兴市| 武城县| 新兴县| 郓城县| 武川县| 平凉市| 鄂温| 邛崃市|