0
我正在製作一個基於tkinter的文本小部件,我試圖在其中實現一個新的窗口功能。但每次我點擊新窗口按鈕時,我得到這個錯誤在IDLE:RuntimeError:Python:Tkinter文本小工具,新窗口按鈕
#!/usr/bin/env python
from Tkinter import *
from tkSimpleDialog import askstring
from tkFileDialog import asksaveasfilename
from tkFileDialog import askopenfilename
from tkMessageBox import askokcancel
import Tkinter as tk
import ttk
import threading
from ScrolledText import ScrolledText
Window = Tk()
Window.title("TekstEDIT")
/..CODE.../
class newWindowThread(threading.Thread):
def __init__(self, choosen=""):
threading.Thread.__init__(self)
self.choosen = choosen
def run(self):
if self.choosen == "":
root = Tk()
newEditor = SimpleEditor(root)
root.mainloop()
else:
root = Tk()
newEditor = SimpleEditor(root, self.choosen)
root.mainloop()
/...CODE.../
wFile = Menu(menubar, tearoff=0,relief="raised")
wFile.add_command(label="New", accelerator="Ctrl+N", command=self.onNew)
wFile.add_command(label="New Window", accelerator="Ctrl+Shift+N", command=self.onNewWindow)
/...CODE.../
def onNewWindow(self):
t=newWindowThread()
t.start()
有什麼問題的根源:從不同的公寓
這裏是我的代碼中調用的Tcl?我該如何解決它?
感謝。