vorweg ich schreibe mein erstes Fensterbasierendes Python Programm mit TKInter. Die Oberfläche funktioniert ohne Probleme. Zusätzlich starte ich vor mainloop() einen Thread.
Code: Alles auswählen
thread.start_new_thread(test, (0,))
Code: Alles auswählen
def test(a):
global infotext
infotext = str()
while True:
infotext = infotext[0:5000]
infotext = "%s\n%s" % (str(time.ctime()), infotext)
try:
me1.configure(text=infotext)
except Exception, detail:
print "ERROR \n%s" % (detail)
time.sleep(2)
Code: Alles auswählen
menubar = Menu(main)
filemenu = Menu(menubar, tearoff=0)
helpmenu = Menu(menubar, tearoff=0)
menubar.add_cascade(label="Datei", menu=filemenu)
menubar.add_cascade(label="Info", menu=helpmenu)
main.config(menu=menubar)
filemenu.add_command(label="Exit", command=main.quit)
helpmenu.add_command(label="Info", command=info)
Gruß Marcia