?? canvas.n
字號:
the display list; if no such item exists, then the selectionbehaves as if the \fIstart\fR argument had not been specified..TP\fBenclosed\fR \fIx1\fR \fIy1\fR \fIx2\fR \fIy2\fRSelects all the items completely enclosed within the rectangularregion given by \fIx1\fR, \fIy1\fR, \fIx2\fR, and \fIy2\fR.\fIX1\fR must be no greater then \fIx2\fR and \fIy1\fR must beno greater than \fIy2\fR..TP\fBoverlapping\fR \fIx1\fR \fIy1\fR \fIx2\fR \fIy2\fRSelects all the items that overlap or are enclosed within therectangular region given by \fIx1\fR, \fIy1\fR, \fIx2\fR,and \fIy2\fR.\fIX1\fR must be no greater then \fIx2\fR and \fIy1\fR must beno greater than \fIy2\fR..TP\fBwithtag \fItagOrId\fRSelects all the items given by \fItagOrId\fR..RE.TP\fIpathName \fBbbox \fItagOrId\fR ?\fItagOrId tagOrId ...\fR?Returns a list with four elements giving an approximate bounding boxfor all the items named by the \fItagOrId\fR arguments.The list has the form ``\fIx1 y1 x2 y2\fR'' such that the drawnareas of all the named elements are within the region bounded by\fIx1\fR on the left, \fIx2\fR on the right, \fIy1\fR on the top,and \fIy2\fR on the bottom.The return value may overestimate the actual bounding box bya few pixels.If no items match any of the \fItagOrId\fR arguments or if thematching items have empty bounding boxes (i.e. they have nothingto display)then an empty string is returned..TP\fIpathName \fBbind \fItagOrId\fR ?\fIsequence\fR? ?\fIcommand\fR?This command associates \fIcommand\fR with all the items given by\fItagOrId\fR such that whenever the event sequence given by\fIsequence\fR occurs for one of the items the command willbe invoked.This widget command is similar to the \fBbind\fR command except thatit operates on items in a canvas rather than entire widgets.See the \fBbind\fR manual entry for complete detailson the syntax of \fIsequence\fR and the substitutions performedon \fIcommand\fR before invoking it.If all arguments are specified then a new binding is created, replacingany existing binding for the same \fIsequence\fR and \fItagOrId\fR(if the first character of \fIcommand\fR is ``+'' then \fIcommand\fRaugments an existing binding rather than replacing it).In this case the return value is an empty string.If \fIcommand\fR is omitted then the command returns the \fIcommand\fRassociated with \fItagOrId\fR and \fIsequence\fR (an error occursif there is no such binding).If both \fIcommand\fR and \fIsequence\fR are omitted then the commandreturns a list of all the sequences for which bindings have beendefined for \fItagOrId\fR..RS.PP.VSThe only events for which bindings may be specified are those related tothe mouse and keyboard (such as \fBEnter\fR, \fBLeave\fR,\fBButtonPress\fR, \fBMotion\fR, and \fBKeyPress\fR) or virtual events.The handling of events in canvases uses the current item defined in ITEMIDS AND TAGS above. \fBEnter\fR and \fBLeave\fR events trigger for anitem when it becomes the current item or ceases to be the current item;note that these events are different than \fBEnter\fR and \fBLeave\fRevents for windows. Mouse-related events are directed to the currentitem, if any. Keyboard-related events are directed to the focus item, ifany (see the \fBfocus\fR widget command below for more on this). If avirtual event is used in a binding, that binding can trigger only if thevirtual event is defined by an underlying mouse-related orkeyboard-related event..VE.PPIt is possible for multiple bindings to match a particular event.This could occur, for example, if one binding is associated with theitem's id and another is associated with one of the item's tags.When this occurs, all of the matching bindings are invoked.A binding associated with the \fBall\fR tag is invoked first,followed by one binding for each of the item's tags (in order),followed by a binding associated with the item's id.If there are multiple matching bindings for a single tag,then only the most specific binding is invoked.A \fBcontinue\fR command in a binding script terminates thatscript, and a \fBbreak\fR command terminates that scriptand skips any remaining scripts for the event, just as for the\fBbind\fR command..PPIf bindings have been created for a canvas window using the \fBbind\fRcommand, then they are invoked in addition to bindings created forthe canvas's items using the \fBbind\fR widget command.The bindings for items will be invoked before any of the bindingsfor the window as a whole..RE.TP\fIpathName \fBcanvasx \fIscreenx\fR ?\fIgridspacing\fR?Given a window x-coordinate in the canvas \fIscreenx\fR, this command returnsthe canvas x-coordinate that is displayed at that location.If \fIgridspacing\fR is specified, then the canvas coordinate isrounded to the nearest multiple of \fIgridspacing\fR units..TP\fIpathName \fBcanvasy \fIscreeny\fR ?\fIgridspacing\fR?Given a window y-coordinate in the canvas \fIscreeny\fR this command returnsthe canvas y-coordinate that is displayed at that location.If \fIgridspacing\fR is specified, then the canvas coordinate isrounded to the nearest multiple of \fIgridspacing\fR units..TP\fIpathName \fBcget\fR \fIoption\fRReturns the current value of the configuration option givenby \fIoption\fR.\fIOption\fR may have any of the values accepted by the \fBcanvas\fRcommand..TP\fIpathName \fBconfigure ?\fIoption\fR? ?\fIvalue\fR? ?\fIoption value ...\fR?Query or modify the configuration options of the widget.If no \fIoption\fR is specified, returns a list describing all ofthe available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR forinformation on the format of this list). If \fIoption\fR is specifiedwith no \fIvalue\fR, then the command returns a list describing theone named option (this list will be identical to the correspondingsublist of the value returned if no \fIoption\fR is specified). Ifone or more \fIoption\-value\fR pairs are specified, then the commandmodifies the given widget option(s) to have the given value(s); inthis case the command returns an empty string.\fIOption\fR may have any of the values accepted by the \fBcanvas\fRcommand..TP\fIpathName\fR \fBcoords \fItagOrId \fR?\fIx0 y0 ...\fR?Query or modify the coordinates that define an item.If no coordinates are specified, this command returns a listwhose elements are the coordinates of the item named by\fItagOrId\fR.If coordinates are specified, then they replace the currentcoordinates for the named item.the first one in the display list is used..TP\fIpathName \fBcreate \fItype x y \fR?\fIx y ...\fR? ?\fIoption value ...\fR?Create a new item in \fIpathName\fR of type \fItype\fR.The exact format of the arguments after \fBtype\fR dependson \fBtype\fR, but usually they consist of the coordinates forone or more points, followed by specifications for zero ormore item options.See the subsections on individual item types below for moreon the syntax of this command.This command returns the id for the new item..TP\fIpathName \fBdchars \fItagOrId first \fR?\fIlast\fR?For each item given by \fItagOrId\fR, delete the charactersin the range given by \fIfirst\fR and \fIlast\fR,inclusive.If some of the items given by \fItagOrId\fR don't supporttext operations, then they are ignored.\fIFirst\fR and \fIlast\fR are indices of characterswithin the item(s) as described in INDICES above.If \fIlast\fR is omitted, it defaults to \fIfirst\fR.This command returns an empty string..TP\fIpathName \fBdelete \fR?\fItagOrId tagOrId ...\fR?Delete each of the items given by each \fItagOrId\fR, and returnan empty string..TP\fIpathName \fBdtag \fItagOrId \fR?\fItagToDelete\fR?For each of the items given by \fItagOrId\fR, delete thetag given by \fItagToDelete\fR from the list of thoseassociated with the item.If an item doesn't have the tag \fItagToDelete\fR thenthe item is unaffected by the command.If \fItagToDelete\fR is omitted then it defaults to \fItagOrId\fR.This command returns an empty string..TP\fIpathName \fBfind \fIsearchCommand \fR?\fIarg arg ...\fR?This command returns a list consisting of all the items thatmeet the constraints specified by \fIsearchCommand\fR and\fIarg\fR's.\fISearchCommand\fR and \fIargs\fR have any of the formsaccepted by the \fBaddtag\fR command.The items are returned in stacking order, with the lowest item first..TP\fIpathName \fBfocus \fR?\fItagOrId\fR?Set the keyboard focus for the canvas widget to the item given by\fItagOrId\fR.If \fItagOrId\fR refers to several items, then the focus is setto the first such item in the display list that supports theinsertion cursor.If \fItagOrId\fR doesn't refer to any items, or if none of themsupport the insertion cursor, then the focus isn't changed.If \fItagOrId\fR is an emptystring, then the focus item is reset so that no item has the focus.If \fItagOrId\fR is not specified then the command returns theid for the item that currently has the focus, or an empty stringif no item has the focus..RS.PPOnce the focus has been set to an item, the item will displaythe insertion cursor and all keyboard events will be directedto that item.The focus item within a canvas and the focus window on thescreen (set with the \fBfocus\fR command) are totally independent:a given item doesn't actually have the input focus unless (a)its canvas is the focus window and (b) the item is the focus itemwithin the canvas.In most cases it is advisable to follow the \fBfocus\fR widgetcommand with the \fBfocus\fR command to set the focus window tothe canvas (if it wasn't there already)..RE.TP\fIpathName \fBgettags\fR \fItagOrId\fRReturn a list whose elements are the tags associated with theitem given by \fItagOrId\fR.If \fItagOrId\fR refers to more than one item, then the tagsare returned from the first such item in the display list.If \fItagOrId\fR doesn't refer to any items, or if the itemcontains no tags, then an empty string is returned..TP\fIpathName \fBicursor \fItagOrId index\fRSet the position of the insertion cursor for the item(s)given by \fItagOrId\fRto just before the character whose position is given by \fIindex\fR.If some or all of the items given by \fItagOrId\fR don't supportan insertion cursor then this command has no effect on them.See INDICES above for a description of thelegal forms for \fIindex\fR.Note: the insertion cursor is only displayed in an item ifthat item currently has the keyboard focus (see the widgetcommand \fBfocus\fR, below), but the cursor position maybe set even when the item doesn't have the focus.This command returns an empty string..TP\fIpathName \fBindex \fItagOrId index\fRThis command returns a decimal string giving the numerical indexwithin \fItagOrId\fR corresponding to \fIindex\fR.\fIIndex\fR gives a textual description of the desired positionas described in INDICES above.The return value is guaranteed to lie between 0 and the numberof characters within the item, inclusive.If \fItagOrId\fR refers to multiple items, then the indexis processed in the first of these items that supports indexingoperations (in display list order)..TP\fIpathName \fBinsert \fItagOrId beforeThis string\fRFor each of the items given by \fItagOrId\fR, if the item supportstext insertion then \fIstring\fR is inserted into the item'stext just before the character whose index is \fIbeforeThis\fR.See INDICES above for information about the forms allowedfor \fIbeforeThis\fR.This command returns an empty string..TP\fIpathName \fBitemcget\fR \fItagOrId\fR \fIoption\fRReturns the current value of the configuration option for theitem given by \fItagOrId\fR whose name is \fIoption\fR.This command is similar to the \fBcget\fR widget command except thatit applies to a particular item rather than the widget as a whole.\fIOption\fR may have any of the values accepted by the \fBcreate\fRwidget command when the item was created.If \fItagOrId\fR is a tag that refers to more than one item,the first (lowest) such item is used..TP\fIpathName \fBitemconfigure \fItagOrId\fR ?\fIoption\fR? ?\fIvalue\fR? ?\fIoption value ...\fR?This command is similar to the \fBconfigure\fR widget command exceptthat it modifies item-specific options for the items given by\fItagOrId\fR instead of modifying options for the overallcanvas widget.If no \fIoption\fR is specified, returns a list describing all ofthe available options for the first item given by \fItagOrId\fR(see \fBTk_ConfigureInfo\fR forinformation on the format of this list). If \fIoption\fR is specifiedwith no \fIvalue\fR, then the command returns a list describing theone named option (this list will be identical to the correspondingsublist of the value returned if no \fIoption\fR is specified). Ifone or more \fIoption\-value\fR pairs are specified, then the commandmodifies the given widget option(s) to have the given value(s) ineach of the items given by \fItagOrId\fR; inthis case the command returns an empty string.The \fIoption\fRs and \fIvalue\fRs are the same as those permissiblein the \fBcreate\fR widget command when the item(s) were created;see the sections describing individual item types below for detailson the legal options..TP\fIpathName \fBlower \fItagOrId \fR?\fIbelowThis\fR?Move all of the items given by \fItagOrId\fR to a new positionin the display list just before the item given by \fIbelowThis\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.\fIBelowThis\fR is a tag or id; if it refers to more than oneitem then the first (lowest) 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 \fBmove \fItagOrId xAmount yAmount\fRMove each of the items given by \fItagOrId\fR in the canvas coordinatespace by adding \fIxAmount\fR to the x-coordinate of each pointassociated with the item and \fIyAmount\fR to the y-coordinate of
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -