?? canvas.n
字號:
each point associated with the item.This command returns an empty string..TP\fIpathName \fBpostscript \fR?\fIoption value option value ...\fR?Generate a Postscript representation for part or all of the canvas.If the \fB\-file\fR option is specified then the Postscript is writtento a file and an empty string is returned; otherwise the Postscriptis returned as the result of the command..VSIf the interpreter that owns the canvas is marked as safe, the operationwill fail because safe interpreters are not allowed to write files.If the \fB\-channel\fR option is specified, the argument denotes the nameof a channel already opened for writing. The Postscript is written tothat channel, and the channel is left open for further writing at the endof the operation..VEThe Postscript is created in Encapsulated Postscript form usingversion 3.0 of the Document Structuring Conventions.Note: by default Postscript is only generated for information thatappears in the canvas's window on the screen. If the canvas isfreshly created it may still have its initial size of 1x1 pixelso nothing will appear in the Postscript. To get around this problemeither invoke the "update" command to wait for the canvas windowto reach its final size, or else use the \fB\-width\fR and \fB\-height\fRoptions to specify the area of the canvas to print.The \fIoption\fR\-\fIvalue\fR argument pairs provide additionalinformation to control the generation of Postscript. The followingoptions are supported:.RS.TP\fB\-colormap \fIvarName\fR\fIVarName\fR must be the name of an array variablethat specifies a color mapping to use in the Postscript.Each element of \fIvarName\fR must consist of Postscriptcode to set a particular color value (e.g. ``\fB1.0 1.0 0.0 setrgbcolor\fR'').When outputting color information in the Postscript, Tk checksto see if there is an element of \fIvarName\fR with the samename as the color.If so, Tk uses the value of the element as the Postscript commandto set the color.If this option hasn't been specified, or if there isn't an entryin \fIvarName\fR for a given color, then Tk uses the red, green,and blue intensities from the X color..TP\fB\-colormode \fImode\fRSpecifies how to output color information. \fIMode\fR must be either\fBcolor\fR (for full color output), \fBgray\fR (convert all colorsto their gray-scale equivalents) or \fBmono\fR (convert all colorsto black or white)..TP\fB\-file \fIfileName\fRSpecifies the name of the file in which to write the Postscript.If this option isn't specified then the Postscript is returned as theresult of the command instead of being written to a file..TP\fB\-fontmap \fIvarName\fR\fIVarName\fR must be the name of an array variablethat specifies a font mapping to use in the Postscript.Each element of \fIvarName\fR must consist of a Tcl list withtwo elements, which are the name and point size of a Postscript font.When outputting Postscript commands for a particular font, Tkchecks to see if \fIvarName\fR contains an element with the samename as the font.If there is such an element, then the font information contained inthat element is used in the Postscript.Otherwise Tk attempts to guess what Postscript font to use.Tk's guesses generally only work for well-known fonts such asTimes and Helvetica and Courier, and only if the X font name does notomit any dashes up through the point size.For example, \fB\-*\-Courier\-Bold\-R\-Normal\-\-*\-120\-*\fR will work but\fB*Courier\-Bold\-R\-Normal*120*\fR will not; Tk needs the dashes toparse the font name)..TP\fB\-height \fIsize\fRSpecifies the height of the area of the canvas to print.Defaults to the height of the canvas window..TP\fB\-pageanchor \fIanchor\fRSpecifies which point of the printed area of the canvas should appear overthe positioning point on the page (which is given by the \fB\-pagex\fRand \fB\-pagey\fR options).For example, \fB\-pageanchor n\fR means that the top center of thearea of the canvas being printed (as it appears in the canvas window)should be over the positioning point. Defaults to \fBcenter\fR..TP\fB\-pageheight \fIsize\fRSpecifies that the Postscript should be scaled in both x and y sothat the printed area is \fIsize\fR high on the Postscript page.\fISize\fR consists of a floating-point number followed by\fBc\fR for centimeters, \fBi\fR for inches, \fBm\fR for millimeters,or \fBp\fR or nothing for printer's points (1/72 inch).Defaults to the height of the printed area on the screen.If both \fB\-pageheight\fR and \fB\-pagewidth\fR are specified thenthe scale factor from \fB\-pagewidth\fR is used (non-uniform scalingis not implemented)..TP\fB\-pagewidth \fIsize\fRSpecifies that the Postscript should be scaled in both x and y sothat the printed area is \fIsize\fR wide on the Postscript page.\fISize\fR has the same form as for \fB\-pageheight\fR.Defaults to the width of the printed area on the screen.If both \fB\-pageheight\fR and \fB\-pagewidth\fR are specified thenthe scale factor from \fB\-pagewidth\fR is used (non-uniform scalingis not implemented)..TP\fB\-pagex \fIposition\fR\fIPosition\fR gives the x-coordinate of the positioning point onthe Postscript page, using any of the forms allowed for \fB\-pageheight\fR.Used in conjunction with the \fB\-pagey\fR and \fB\-pageanchor\fR optionsto determine where the printed area appears on the Postscript page.Defaults to the center of the page..TP\fB\-pagey \fIposition\fR\fIPosition\fR gives the y-coordinate of the positioning point onthe Postscript page, using any of the forms allowed for \fB\-pageheight\fR.Used in conjunction with the \fB\-pagex\fR and \fB\-pageanchor\fR optionsto determine where the printed area appears on the Postscript page.Defaults to the center of the page..TP\fB\-rotate \fIboolean\fR\fIBoolean\fR specifies whether the printed area is to be rotated 90degrees.In non-rotated output the x-axis of the printed area runs alongthe short dimension of the page (``portrait'' orientation);in rotated output the x-axis runs along the long dimension of thepage (``landscape'' orientation).Defaults to non-rotated..TP\fB\-width \fIsize\fRSpecifies the width of the area of the canvas to print.Defaults to the width of the canvas window..TP\fB\-x \fIposition\fRSpecifies the x-coordinate of the left edge of the area of thecanvas that is to be printed, in canvas coordinates, not windowcoordinates.Defaults to the coordinate of the left edge of the window..TP\fB\-y \fIposition\fRSpecifies the y-coordinate of the top edge of the area of thecanvas that is to be printed, in canvas coordinates, not windowcoordinates.Defaults to the coordinate of the top edge of the window..RE.TP\fIpathName \fBraise \fItagOrId \fR?\fIaboveThis\fR?Move all of the items given by \fItagOrId\fR to a new positionin the display list just after the item given by \fIaboveThis\fR.If \fItagOrId\fR refers to more than one item then all are movedbut the relative order of the moved items will not be changed.\fIAboveThis\fR is a tag or id; if it refers to more than oneitem then the last (topmost) of these items in the display list is usedas the destination location for the moved items.Note: this command has no effect on window items. Window items alwaysobscure other item types, and the stacking order of window items isdetermined by the \fBraise\fR and \fBlower\fR commands, not the\fBraise\fR and \fBlower\fR widget commands for canvases.This command returns an empty string..TP\fIpathName \fBscale \fItagOrId xOrigin yOrigin xScale yScale\fRRescale all of the items given by \fItagOrId\fR in canvas coordinatespace.\fIXOrigin\fR and \fIyOrigin\fR identify the origin for the scalingoperation and \fIxScale\fR and \fIyScale\fR identify the scalefactors for x- and y-coordinates, respectively (a scale factor of1.0 implies no change to that coordinate).For each of the points defining each item, the x-coordinate isadjusted to change the distance from \fIxOrigin\fR by a factorof \fIxScale\fR.Similarly, each y-coordinate is adjusted to change the distancefrom \fIyOrigin\fR by a factor of \fIyScale\fR.This command returns an empty string..TP\fIpathName \fBscan\fR \fIoption args\fRThis command is used to implement scanning on canvases. It hastwo forms, depending on \fIoption\fR:.RS.TP\fIpathName \fBscan mark \fIx y\fRRecords \fIx\fR and \fIy\fR and the canvas's current view; usedin conjunction with later \fBscan dragto\fR commands.Typically this command is associated with a mouse button press inthe widget and \fIx\fR and \fIy\fR are the coordinates of themouse. It returns an empty string..TP\fIpathName \fBscan dragto \fIx y\fR.This command computes the difference between its \fIx\fR and \fIy\fRarguments (which are typically mouse coordinates) and the \fIx\fR and\fIy\fR arguments to the last \fBscan mark\fR command for the widget.It then adjusts the view by 10 times thedifference in coordinates. This command is typically associatedwith mouse motion events in the widget, to produce the effect ofdragging the canvas at high speed through its window. The returnvalue is an empty string..RE.TP\fIpathName \fBselect \fIoption\fR ?\fItagOrId arg\fR?Manipulates the selection in one of several ways, depending on\fIoption\fR.The command may take any of the forms described below.In all of the descriptions below, \fItagOrId\fR must refer toan item that supports indexing and selection; if it refers tomultiple items then the first ofthese that supports indexing and the selection is used.\fIIndex\fR gives a textual description of a positionwithin \fItagOrId\fR, as described in INDICES above..RS.TP\fIpathName \fBselect adjust \fItagOrId index\fRLocate the end of the selection in \fItagOrId\fR nearestto the character given by \fIindex\fR, and adjust thatend of the selection to be at \fIindex\fR (i.e. includingbut not going beyond \fIindex\fR).The other end of the selection is made the anchor pointfor future \fBselect to\fR commands.If the selection isn't currently in \fItagOrId\fR thenthis command behaves the same as the \fBselect to\fR widgetcommand.Returns an empty string..TP\fIpathName \fBselect clear\fRClear the selection if it is in this widget.If the selection isn't in this widget then the commandhas no effect.Returns an empty string..TP\fIpathName \fBselect from \fItagOrId index\fRSet the selection anchor point for the widget to be justbefore the charactergiven by \fIindex\fR in the item given by \fItagOrId\fR.This command doesn't change the selection; it just setsthe fixed end of the selection for future \fBselect to\fRcommands.Returns an empty string..TP\fIpathName \fBselect item\fRReturns the id of the selected item, if the selection is in anitem in this canvas.If the selection is not in this canvas then an empty stringis returned..TP\fIpathName \fBselect to \fItagOrId index\fRSet the selection to consist of those characters of \fItagOrId\fRbetween the selection anchor point and\fIindex\fR.The new selection will include the character given by \fIindex\fR;it will include the character given by the anchor point only if\fIindex\fR is greater than or equal to the anchor point.The anchor point is determined by the most recent \fBselect adjust\fRor \fBselect from\fR command for this widget.If the selection anchor point for the widget isn't currently in\fItagOrId\fR, then it is set to the same character givenby \fIindex\fR.Returns an empty string..RE.TP\fIpathName \fBtype\fI tagOrId\fRReturns the type of the item given by \fItagOrId\fR, such as\fBrectangle\fR or \fBtext\fR.If \fItagOrId\fR refers to more than one item, then the typeof the first item in the display list is returned.If \fItagOrId\fR doesn't refer to any items at all thenan empty string is returned..TP\fIpathName \fBxview \fR?\fIargs\fR?This command is used to query and change the horizontal position of theinformation displayed in the canvas's window.It can take any of the following forms:.RS.TP\fIpathName \fBxview\fRReturns a list containing two elements.Each element is a real fraction between 0 and 1; together they describethe horizontal span that is visible in the window.For example, if the first element is .2 and the second element is .6,20% of the canvas's area (as defined by the \fB\-scrollregion\fR option)is off-screen to the left, the middle 40% is visiblein the window, and 40% of the canvas is off-screen to the right.These are the same values passed to scrollbars via the \fB\-xscrollcommand\fRoption..TP\fIpathName \fBxview moveto\fI fraction\fRAdjusts the view in the window so that \fIfraction\fR of thetotal width of the canvas is off-screen to the left.\fIFraction\fR must be a fraction between 0 and 1..TP\fIpathName \fBxview scroll \fInumber what\fRThis command shifts the view in the window left or right according to\fInumber\fR and \fIwhat\fR.\fINumber\fR must be an integer.\fIWhat\fR must be either \fBunits\fR or \fBpages\fR or an abbreviationof one of these.If \fIwhat\fR is \fBunits\fR, the view adjusts left or right in unitsof the \fBxScrollIncrement\fR option, if it is greater than zero,or in units of one-tenth the window's width otherwise.If \fIwhat is \fBpages\fR then the view
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -