Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I display symbols? 1

Status
Not open for further replies.

sh00der

Technical User
Jul 15, 2003
58
CA
I can't figure out how to display symbols in a text widget in the output of a tk/tcl script. I want to be able to display units of various properties that would include being able to display a degrees symbol and superscripts (for powers). Is it possible and how can I do it?

45 deg C and 50 kgm^-3 looks horrible!
 
You have to use tags:
pathName insert index chars ?tagList chars tagList ...?
Inserts all of the chars arguments just before the character at index. If index refers to the end of the text (the character after the last newline) then the new text is inserted just before the last newline instead. If there is a single chars argument and no tagList, then the new text will receive any tags that are present on both the character before and the character after the insertion point; if a tag is present on only one of these characters then it will not be applied to the new text. If tagList is specified then it consists of a list of tag names; the new characters will receive all of the tags in this list and no others, regardless of the tags present around the insertion point. If multiple chars-tagList argument pairs are present, they produce the same effect as if a separate insert widget command had been issued for each pair, in order. The last tagList argument may be omitted.

then, you can specify the font of the tagged characters
display options may be associated with individual tags using the ``pathName tag configure'' widget command. If a character has been tagged, then the display options associated with the tag override the default display style. The following options are currently supported for tags:
...
-font fontName
FontName is the name of a font to use for drawing characters. It may have any of the forms accepted by Tk_GetFont.
...

Bob Rashkin
rrashkin@csc.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top