mein Programm sieht so aus:
Code: Alles auswählen
from huffmanCode import *
from Tkinter import *
from tkFileDialog import *
import thread
import time
a=True
win=Tk()
win.title('Huffman-Komprimierer')
fenster=Frame(win).pack()
percent2=StringVar()
percent2.set(str(0.0)+' Prozent')
def run():
thread.start_new_thread(status,())
myPath()
def myPath():
global a
a=True
myPath = askopenfilename(filetypes=[("alle Formate", "*")])
hu=huffman(myPath)
if myPath[-4:]=='.txt':
hu.write()
elif myPath[-4:]=='.dsm':
hu.read()
else:
print 'Fehler'
a=False
def status():
while a:
f=open('Fortschritt','r')
percent2.set(f.read())
f.close()
win.update()
time.sleep(1)
#p1.join()
#p2.join()
Input=Button(fenster, text='Input-Datei', command=run).pack()
Prozent=Label(fenster, textvariable=percent2).pack()
mainloop()
win.destroy()
Das Programm hängt sich jedes Mal auf. Ziel ist es, das die Programme myPath() und status() parallel ablaufen, ich hoffe jemand kann mir helfen.
MfGrüßen
daniels7[/code]