0
Python3.5では以下のコードは動作しません(RuntimeError:別のアパートメントからTclを呼び出す) Python 2.7上でうまく動作します 難しいです問題の原因を知っていると私はそれを修正することができます。Python 3でのtkinterエラー(RuntimeError:別のAppartmentからのTclの呼び出し)
import tkinter
import threading
class MyTkApp(threading.Thread):
def __init__(self):
self.root=tkinter.Tk()
self.s = tkinter.StringVar()
self.s.set('Foo')
l = tkinter.Label(self.root,textvariable=self.s)
l.pack()
threading.Thread.__init__(self)
def run(self):
self.root.mainloop()
app = MyTkApp()
app.start()