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

您的位置:首頁技術(shù)文章
文章詳情頁

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

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

問題描述

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

# -*- 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里面寫的是死循環(huán),永遠不會結(jié)束你應該新啟一個子線程才對

標簽: Python 編程
主站蜘蛛池模板: 清涧县| 榆树市| 甘孜县| 杨浦区| 阳山县| 乌拉特前旗| 天全县| 社旗县| 鄱阳县| 绍兴市| 平远县| 洪洞县| 邳州市| 陆川县| 禹城市| 托里县| 和政县| 姚安县| 德格县| 前郭尔| 巴塘县| 海林市| 潜江市| 和田市| 奉新县| 诏安县| 吴桥县| 巴彦淖尔市| 施秉县| 淮安市| 龙门县| 攀枝花市| 海门市| 綦江县| 景德镇市| 岳池县| 临朐县| 两当县| 溆浦县| 蒙山县| 杭锦旗|