Python: 3.9.5Os: macOS 11.4
from tkinter import *
window = Tk()
e1_value = StringVar()
def printText():
print(e1_value.get())
# def printText():
# print('HelloWorld!')
b1 = Button(window, text = "Excute", command = printText())
b1.grid(row = 0, column = 0)
e1 = Entry(window, textvariable = e1_value)
e1.grid(row = 0, column = 1)
t1 = Text(window, height = 1, width = 20)
t1.grid(row = 0, column = 2)
window.mainloop()我遇到了一个在终端打印出来的错误,所以我无法将值打印到终端中。错误上说,
"TSM AdjustCapsLockLEDForKeyTransitionHandling - _ISSetPhysicalKeyboardCapsLockLED Inhib“
,当我在入口窗口中键入某项内容时。我一直在谷歌上搜索答案,但仍然找不到答案。你知道如何解决这个问题吗?
此外,我还能看到“你好世界!”即使我按了几下按钮也只有一次。
我对tkinter不熟悉,所以我不知道该怎么办。
发布于 2021-07-05 01:27:48
我在printText之后删除了括号。b1 = Button(window, text = "Excute", command = printText)
我可以打印我在输入框中输入的内容。不过,我还是看到了"TSM AdjustCapsLockLEDForKeyTransitionHandling - _ISSetPhysicalKeyboardCapsLockLED Inhib“。
from tkinter import *
window = Tk()
e1_value = StringVar()
def printText():
print(e1_value.get())
# def printText():
# print('HelloWorld!')
b1 = Button(window, text = "Excute", command = printText)
b1.grid(row = 0, column = 0)
e1 = Entry(window, textvariable = e1_value)
e1.grid(row = 0, column = 1)
t1 = Text(window, height = 1, width = 20)
t1.grid(row = 0, column = 2)
window.mainloop()发布于 2021-07-16 20:16:58
这是因为你的键盘偏好中有另一种语言。
删除键盘首选项中非英语的语言
https://stackoverflow.com/questions/68218983
复制相似问题