我想創建一個「無邊界」窗口在Python中,我的代碼工作沒有overrideredirect,但是當我使用這個輸入是不允許的。我不能點擊進入輸入框tkinter overrideredirect停止輸入工作
*這是一個需要被想通了代碼,它目前是一個函數,還有另一個代碼500線,它去:d *
newWindow = tkinter.Tk()
w = 300
h = 400
ws = 1024
hs = 768
x = (ws/2) - (w/2)
y = (hs/2) - (h/2)
newWindow.configure(background="#2E393D")
newWindow.overrideredirect(True)
frame = tkinter.Frame(newWindow)
name = tkinter.Label(newWindow, background="#1c1c1c", width=2, height=4)
name.pack()
global outputl
global inputl
inputl = tkinter.StringVar()
outputl = tkinter.StringVar()
def nomic(empty):
reply = inputl.get()
inputl.set("")
mainProcess(reply)
if way == "a":
import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone() as source:
audio = r.listen(source)
try:
reply = r.recognize_google(audio)
mainProcess(reply)
except sr.UnknownValueError:
backCreateFile("I did not understand that !")
else:
inputBox = tkinter.Entry(frame, textvariable=inputl, width=40,foreground="#2E393D", background="white", font=("Ubuntu", 13))
inputBox.bind("<Return>", nomic)
inputBox.pack(fill="x")
outputLabel = tkinter.Label(newWindow, textvariable=outputl)
outputLabel.config(background="#2E393D", foreground="white", wraplength=280, pady=10, font=("Ubuntu", 13))
outputLabel.pack(fill="x")
weatherV = tkinter.StringVar()
weatherV.set("Current Weather - " + status)
weatherLabel = tkinter.Label(newWindow, justify="left", textvariable=weatherV, background="#2E393D", foreground="white", font=("Ubuntu", 13), pady=7).pack(fill="x")
tempV = tkinter.StringVar()
tempV.set("Current Temperature - " + str(ctemp))
tempLabel = tkinter.Label(newWindow, justify="left", textvariable=tempV, background="#2E393D", foreground="white", font=("Ubuntu", 13), pady=7).pack(fill="x")
frame.pack()
你在哪個平臺上運行? OSX? –
請閱讀https://stackoverflow.com/help/mcve並將您的示例代碼替換爲MCVE –