Python3.3:是否可以使用tkinter在按钮上放置unicode字符?

Python3.3:是否可以使用tkinter在按钮上放置unicode字符?,python,unicode,Python,Unicode,我正试图找到一种在按钮上添加unicode字符的方法 例如,我的想法是这样做: checkButton = Button(root, height=5, width=10, image=u"\u2713") 不幸的是,我遇到了以下错误: File "C:\Python33\lib\tkinter\__init__.py", line 2075, in __init__ (widgetName, self._w) + extra + self._options(cnf)) _tkinte

我正试图找到一种在按钮上添加unicode字符的方法

例如,我的想法是这样做:

checkButton = Button(root, height=5, width=10, image=u"\u2713")
不幸的是,我遇到了以下错误:

File "C:\Python33\lib\tkinter\__init__.py", line 2075, in __init__
    (widgetName, self._w) + extra + self._options(cnf))
_tkinter.TclError: image "✓" doesn't exist

有人知道我可以用什么方法做这样的事情吗?

您设置了错误的属性<代码>图像用于显示按钮上是否有图像(它指定图像的路径)。您需要
文本
属性。尝试:

checkButton = Button(root, height=5, width=10, text=u"\u2713")
根据:

对于大多数系统,Tkinter应该接受unicode字符串并进行渲染 它们或多或少都是正确的


另请参见设置错误的属性<代码>图像用于显示按钮上是否有图像(它指定图像的路径)。您需要
文本
属性。尝试:

checkButton = Button(root, height=5, width=10, text=u"\u2713")
根据:

对于大多数系统,Tkinter应该接受unicode字符串并进行渲染 它们或多或少都是正确的


另请参见

这当然取决于您是否拥有具有适当字形的字体。这当然取决于您是否拥有具有适当字形的字体。