import threading
import time
import os
event = threading.Event()
def walk(path):
event.wait()
try:
if os.path.isdir(path):
for file in os.listdir(path):
file_path = os.path.join(path, file)
for sub_file in walk(file_path):
yield sub_file
else:
yield path
except:
print "read file error!!"
def func():
for file in walk("/"):
print file
def test():
th2 = threading.Thread(target=func)
th2.setDaemon(True)
th2.start()
if __name__ == '__main__':
def btn_clicked(widget):
test()
print "start..."
def stop_btn_clicked(widget):
event.clear()
def start_btn_clicked(widget):
event.set()
import gtk
gtk.gdk.thr
import time
import os
event = threading.Event()
def walk(path):
event.wait()
try:
if os.path.isdir(path):
for file in os.listdir(path):
file_path = os.path.join(path, file)
for sub_file in walk(file_path):
yield sub_file
else:
yield path
except:
print "read file error!!"
def func():
for file in walk("/"):
print file
def test():
th2 = threading.Thread(target=func)
th2.setDaemon(True)
th2.start()
if __name__ == '__main__':
def btn_clicked(widget):
test()
print "start..."
def stop_btn_clicked(widget):
event.clear()
def start_btn_clicked(widget):
event.set()
import gtk
gtk.gdk.thr