Version of Canvas create_text() that supports word wrap?
Is there a create_text()
mode or technique that supports word wrap? I'm stuck using create_text()
vs. a Label
or Text
widget because I'm placing text on top of an image on my Canvas.
Also, is there a Tkinter API开发者_如何学Python that truncates text that doesn't fit a certain width with an ellipsis like suffix, eg. Where very, very, very long text
gets converted to something like Where very, very, ...
.
There is indeed a word wrap feature in create_text()
. You'd call it like so:
canvas.create_text(x, y, width=80)
You can set the width parameter to whatever max length you want, or 0 if you want no word wrapping. See this article for all the options, arguments etc. for create_text()
.
I'm not sure about truncating text, but I did see this talking about a way to limit the length of input in an Entry widget...
精彩评论