Tkinter Canvas Text adding Border (outline)

时间:2022-03-03 10:16:49

I'm having trouble to add borders (outline) in Tkinter Canvas Text, like this:

我无法在Tkinter Canvas Text中添加边框(轮廓),如下所示:

Tkinter Canvas Text adding Border (outline)

but:

self.text1 = self.canvasFrame.create_text(100, 100, text = "Hello",
    font = NORMAL_FONT, fill = BLUE_COLOR, borderwidth = 2)


File "/usr/lib/python3.4/tkinter/__init__.py", line 2321, in _create
*(args + self._options(cnf, kw))))
_tkinter.TclError: unknown option "-borderwidth"

and I tried "bd = 2" too...

我也试过“bd = 2”......

File "/usr/lib/python3.4/tkinter/__init__.py", line 2321, in _create
*(args + self._options(cnf, kw))))
_tkinter.TclError: unknown option "-bd"

Is there any way to do this?

有没有办法做到这一点?

1 个解决方案

#1


2  

No, there is no way to do what you want. The text items of the canvas don't support a borderwidth option, or any other option that would give you the effect you desire.

不,没有办法做你想做的事。画布的文本项不支持borderwidth选项,或任何其他可以提供所需效果的选项。

#1


2  

No, there is no way to do what you want. The text items of the canvas don't support a borderwidth option, or any other option that would give you the effect you desire.

不,没有办法做你想做的事。画布的文本项不支持borderwidth选项,或任何其他可以提供所需效果的选项。