anchor
Legal values are points of the compass: "n"
, "ne"
, "e"
, "se"
, "s"
, "sw"
, "w"
, "nw"
, and also "center"
.
位图
There are eight built-in, named bitmaps: 'error'
, 'gray25'
, 'gray50'
, 'hourglass'
, 'info'
, 'questhead'
, 'question'
, 'warning'
. To specify an X bitmap filename, give the full path to the file, preceded with an @
, as in "@/usr/contrib/bitmap/gumby.bit"
.
boolean
You can pass integers 0 or 1 or the strings "yes"
or "no"
.
callback — 回调
This is any Python function that takes no arguments. For example:
def printit():
print(“hi there”)
fred[“command”] = print_it
color
Colors can be given as the names of X colors in the rgb.txt file, or as strings representing RGB values in 4 bit: "#RGB"
, 8 bit: "#RRGGBB"
, 12 bit” "#RRRGGGBBB"
, or 16 bit "#RRRRGGGGBBBB"
ranges, where R,G,B here represent any legal hex digit. See page 160 of Ousterhout’s book for details.
cursor
The standard X cursor names from cursorfont.h
can be used, without the `XCprefix. For example to get a hand cursor (
XC_hand2), use the string
“hand2”. You can also specify a bitmap and mask file of your own. See page 179 of Ousterhout's book.<br />distance<br />Screen distances can be specified in either pixels or absolute distances. Pixels are given as numbers and absolute distances as strings, with the trailing character denoting units:
cfor centimetres,
ifor inches,
mfor millimetres,
pfor printer's points. For example, 3.5 inches is expressed as
“3.5i”.<br />font<br />Tk uses a list font name format, such as
{courier 10 bold}. Font sizes with positive numbers are measured in points; sizes with negative numbers are measured in pixels.<br />geometry<br />This is a string of the form
widthxheight, where width and height are measured in pixels for most widgets (in characters for widgets displaying text). For example:
fred[“geometry”] = “200x100”.<br />justify<br />Legal values are the strings:
“left”,
“center”,
“right”, and
“fill”.<br />region<br />This is a string with four space-delimited elements, each of which is a legal distance (see above). For example:
“2 3 4 5”and
“3i 2i 4.5i 2i”and
“3c 2c 4c 10.43c”are all legal regions.<br />relief<br />Determines what the border style of a widget will be. Legal values are:
“raised”,
“sunken”,
“flat”,
“groove”, and
“ridge”.<br />scrollcommand<br />This is almost always the
set()method of some scrollbar widget, but can be any widget method that takes a single argument.<br />wrap<br />Must be one of:
“none”,
“char”, or
“word”`.