Hoffe das ich im richtigen Topic bin da auch ein Tkinter-fehler mit dabei zu sein scheint.
Das unten aufgeführte Programm funktioniert soweit Problemlos nur wenn
ich das Fenster schließe kommen die darunter aufgeführte Fehler.
Mir ist nicht ganz klar warum. Muss ich den Thread beenden ?
aus der lib bin ich absolut nicht schlau geworden. "Dazu scheine ich noch zu wenig ahnung zu haben"
Code: Alles auswählen
# Uhr.py
from Tkinter import *
from time import *
from threading import *
from string import *
class Uhr(Thread):
def __init__(self):
Thread.__init__(self)
self.root = Tk()
self.text = StringVar()
self.label = Label(self.root,textvariable=self.text,font=("ARIAL",20),width=10,height=2)
self.label.pack()
self.start()
self.root.mainloop()
def run(self):
while 1:
self.label.config(text=self.text)
self.text.set(split(asctime())[3])
sleep(0.5)
a = Uhr()
Traceback (most recent call last):
File "C:\Python25\lib\threading.py", line 460, in __bootstrap
self.run()
File "C:\Python25\Uhr.py", line 22, in run
self.label.config(text=self.text)
File "C:\Python25\lib\lib-tk\Tkinter.py", line 1197, in configure
return self._configure('configure', cnf, kw)
File "C:\Python25\lib\lib-tk\Tkinter.py", line 1188, in _configure
self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))
TclError: invalid command name ".12285192"
Programiere noch nicht lange
vielen Dank im voraus für eure Hilfe.
mfg
Smokie_joe