我一直在学习 tkinterTkinter 中的消息小部件 https://python-course.eu/tkinter/message-widget-in-tkinter.php at Python 课程和教程 https://python-course.eu/.
当我使用网站上提供的选项添加锚点选项时,我不断收到错误。有人告诉我NE
不存在但是NE
在上面的链接中作为锚选项给出:
NameError: name 'NE' is not defined
这是我的代码。
import tkinter
root = tkinter.Tk()
message = ("Whatever you do will be insignificant,"
"but it is very important that you do it.\n"
"(Mahatma Gandhi)")
msg = tkinter.Message(root,text = message, anchor = NE, aspect = 1000,
foreground='red', background='yellow',
highlightcolor='green', highlightthickness=0,
borderwidth=500)
#msg.config(bg='lightgreen', font=('times', 24, 'italic'))
msg.pack()
tkinter.mainloop()
Edit:我也尝试输入'NE'
用单引号括起来,但它不起作用。