You can display one or more lines of text on a canvas
by
creating a text object:C
id
=C
.create_text (x
,y
,option
, ... )
This returns the object
ID of the text object on canvas
.
Options include:C
anchor | The default is
anchor=CENTER , meaning
that the text is centered vertically and
horizontally around position
( ,
).
See Section 4.5, “Anchors” for possible
values. For example, if you specify
anchor=SW , the text will
be positioned so its lower left corner is at
point
( ,
). |
fill | The default text color is black, but you can
render it in any color by setting the
fill option to that
color. See Section 4.3, “Colors”. |
font | If you don't like the default font, set this option to any font value. See Section 4.4, “Type fonts”. |
justify | For multi-line textual displays, this option
controls how the lines are justified:
LEFT (the default),
CENTER , or
RIGHT . |
stipple | A bitmap indicating how the text will be
stippled. Default is
stipple="" , which means
solid. A typical value would be
stipple="gray25" . See
Section 4.7, “Bitmaps”. |
tags | The tags to be associated with the object, as a sequence of strings. See Section 6.1.4, “Canvas tags”. |
text | The text to be displayed in the object, as a
string. Use newline characters
("\n" ) to force line
breaks. |
width | If you don't specify a
width option, the text
will be set inside a rectangle as long as the
longest line. However, you can also set the
width option to a
dimension, and each line of the text will be
broken into shorter lines, if necessary, or even
broken within words, to fit within the specified
width. See Section 4.1, “Dimensions”. |