📄 wm.n
字号:
is de-iconified then \fIpathName\fR will be unmapped again. If\fIpathName\fR is specified as an empty string then any existingicon window association for \fIwindow\fR will be cancelled. Ifthe \fIpathName\fR argument is specified then an empty string isreturned. Otherwise the command returns the path name of thecurrent icon window for \fIwindow\fR, or an empty string if thereis no icon window currently specified for \fIwindow\fR.Button press events are disabled for \fIwindow\fR as long as it isan icon window; this is needed in order to allow window managersto ``own'' those events.Note: not all window managers support the notion of an icon window..TP\fBwm maxsize \fIwindow\fR ?\fIwidth height\fR?If \fIwidth\fR and \fIheight\fR are specified, they givethe maximum permissible dimensions for \fIwindow\fR.For gridded windows the dimensions are specified ingrid units; otherwise they are specified in pixel units.The window manager will restrict the window's dimensions to beless than or equal to \fIwidth\fR and \fIheight\fR.If \fIwidth\fR and \fIheight\fR arespecified, then the command returns an empty string. Otherwiseit returns a Tcl list with two elements, which are themaximum width and height currently in effect.The maximum size defaults to the size of the screen.If resizing has been disabled with the \fBwm resizable\fR command,then this command has no effect.See the sections on geometry management below for more information..TP\fBwm minsize \fIwindow\fR ?\fIwidth height\fR?If \fIwidth\fR and \fIheight\fR are specified, they give theminimum permissible dimensions for \fIwindow\fR.For gridded windows the dimensions are specified ingrid units; otherwise they are specified in pixel units.The window manager will restrict the window's dimensions to begreater than or equal to \fIwidth\fR and \fIheight\fR.If \fIwidth\fR and \fIheight\fR arespecified, then the command returns an empty string. Otherwiseit returns a Tcl list with two elements, which are theminimum width and height currently in effect.The minimum size defaults to one pixel in each dimension.If resizing has been disabled with the \fBwm resizable\fR command,then this command has no effect.See the sections on geometry management below for more information..TP\fBwm overrideredirect \fIwindow\fR ?\fIboolean\fR?If \fIboolean\fR is specified, it must have a proper boolean form andthe override-redirect flag for \fIwindow\fR is set to that value.If \fIboolean\fR is not specified then \fB1\fR or \fB0\fR isreturned to indicate whether or not the override-redirect flagis currently set for \fIwindow\fR.Setting the override-redirect flag for a window causesit to be ignored by the window manager; among other things, this meansthat the window will not be reparented from the root window into adecorative frame and the user will not be able to manipulate thewindow using the normal window manager mechanisms..TP\fBwm positionfrom \fIwindow\fR ?\fIwho\fR?If \fIwho\fR is specified, it must be either \fBprogram\fR or\fBuser\fR, or an abbreviation of one of these two. It indicateswhether \fIwindow\fR's current position was requested by theprogram or by the user. Many window managers ignore program-requestedinitial positions and ask the user to manually position the window; if\fBuser\fR is specified then the window manager should position thewindow at the given place without asking the user for assistance.If \fIwho\fR is specified as an empty string, then the current positionsource is cancelled.If \fIwho\fR is specified, then the command returns an empty string.Otherwise it returns \fBuser\fR or \fBwindow\fR to indicate thesource of the window's current position, or an empty string ifno source has been specified yet. Most window managers interpret``no source'' as equivalent to \fBprogram\fR.Tk will automatically set the position source to \fBuser\fRwhen a \fBwm geometry\fR command is invoked, unless the source hasbeen set explicitly to \fBprogram\fR..TP\fBwm protocol \fIwindow\fR ?\fIname\fR? ?\fIcommand\fR?This command is used to manage window manager protocols such as\fBWM_DELETE_WINDOW\fR.\fIName\fR is the name of an atom corresponding to a window managerprotocol, such as \fBWM_DELETE_WINDOW\fR or \fBWM_SAVE_YOURSELF\fRor \fBWM_TAKE_FOCUS\fR.If both \fIname\fR and \fIcommand\fR are specified, then \fIcommand\fRis associated with the protocol specified by \fIname\fR.\fIName\fR will be added to \fIwindow\fR's \fBWM_PROTOCOLS\fRproperty to tell the window manager that the application has aprotocol handler for \fIname\fR, and \fIcommand\fR willbe invoked in the future whenever the window manager sends amessage to the client for that protocol.In this case the command returns an empty string.If \fIname\fR is specified but \fIcommand\fR isn't, then the currentcommand for \fIname\fR is returned, or an empty string if thereis no handler defined for \fIname\fR.If \fIcommand\fR is specified as an empty string then the currenthandler for \fIname\fR is deleted and it is removed from the\fBWM_PROTOCOLS\fR property on \fIwindow\fR; an empty string isreturned.Lastly, if neither \fIname\fR nor \fIcommand\fR is specified, thecommand returns a list of all the protocols for which handlersare currently defined for \fIwindow\fR..RS.PPTk always defines a protocol handler for \fBWM_DELETE_WINDOW\fR, even ifyou haven't asked for one with \fBwm protocol\fR.If a \fBWM_DELETE_WINDOW\fR message arrives when you haven't defineda handler, then Tk handles the message by destroying the window forwhich it was received..RE.TP\fBwm resizable \fIwindow\fR ?\fIwidth height\fR?This command controls whether or not the user may interactivelyresize a top-level window. If \fIwidth\fR and \fIheight\fR arespecified, they are boolean values that determine whether thewidth and height of \fIwindow\fR may be modified by the user.In this case the command returns an empty string.If \fIwidth\fR and \fIheight\fR are omitted then the commandreturns a list with two 0/1 elements that indicate whether thewidth and height of \fIwindow\fR are currently resizable.By default, windows are resizable in both dimensions.If resizing is disabled, then the window's size will be the sizefrom the most recent interactive resize or \fBwm geometry\fRcommand. If there has been no such operation thenthe window's natural size will be used..TP\fBwm sizefrom \fIwindow\fR ?\fIwho\fR?If \fIwho\fR is specified, it must be either \fBprogram\fR or\fBuser\fR, or an abbreviation of one of these two. It indicateswhether \fIwindow\fR's current size was requested by theprogram or by the user. Some window managers ignore program-requestedsizes and ask the user to manually size the window; if\fBuser\fR is specified then the window manager should give thewindow its specified size without asking the user for assistance.If \fIwho\fR is specified as an empty string, then the current sizesource is cancelled.If \fIwho\fR is specified, then the command returns an empty string.Otherwise it returns \fBuser\fR or \fBwindow\fR to indicate thesource of the window's current size, or an empty string ifno source has been specified yet. Most window managers interpret``no source'' as equivalent to \fBprogram\fR..TP\fBwm state \fIwindow\fRReturns the current state of \fIwindow\fR: either \fBnormal\fR,\fBiconic\fR, \fBwithdrawn\fR, or \fBicon\fR. The differencebetween \fBiconic\fR and \fBicon\fR is that \fBiconic\fR refersto a window that has been iconified (e.g., with the \fBwm iconify\fRcommand) while \fBicon\fR refers to a window whose only purpose isto serve as the icon for some other window (via the \fBwm iconwindow\fRcommand)..TP\fBwm title \fIwindow\fR ?\fIstring\fR?If \fIstring\fR is specified, then it will be passed to the windowmanager for use as the title for \fIwindow\fR (the window managershould display this string in \fIwindow\fR's title bar). In thiscase the command returns an empty string. If \fIstring\fR isn'tspecified then the command returns the current title for the\fIwindow\fR. The title for a window defaults to its name..TP\fBwm transient \fIwindow\fR ?\fImaster\fR?If \fImaster\fR is specified, then the window manager is informedthat \fIwindow\fR is a transient window (e.g. pull-down menu) workingon behalf of \fImaster\fR (where \fImaster\fR is thepath name for a top-level window). Some window managers will usethis information to manage \fIwindow\fR specially. If \fImaster\fRis specified as an empty string then \fIwindow\fR is marked as notbeing a transient window any more. If \fImaster\fR is specified,then the command returns an empty string. Otherwise the commandreturns the path name of \fIwindow\fR's current master, or anempty string if \fIwindow\fR isn't currently a transient window..TP\fBwm withdraw \fIwindow\fRArranges for \fIwindow\fR to be withdrawn from the screen. Thiscauses the window to be unmapped and forgotten about by the windowmanager. If the windowhas never been mapped, then this commandcauses the window to be mapped in the withdrawn state. Not allwindow managers appear to know how to handle windows that aremapped in the withdrawn state.Note: it sometimes seems to be necessary to withdraw awindow and then re-map it (e.g. with \fBwm deiconify\fR) to get somewindow managers to pay attention to changes in window attributessuch as group..SH "GEOMETRY MANAGEMENT".PPBy default a top-level window appears on the screen in its\fInatural size\fR, which is the one determined internally by itswidgets and geometry managers.If the natural size of a top-level window changes, then the window's sizechanges to match.A top-level window can be given a size other than its natural size in two ways.First, the user can resize the window manually using the facilitiesof the window manager, such as resize handles.Second, the application can request a particular size for atop-level window using the \fBwm geometry\fR command.These two cases are handled identically by Tk; in either case,the requested size overrides the natural size.You can return the window to its natural by invoking \fBwm geometry\fRwith an empty \fIgeometry\fR string..PPNormally a top-level window can have any size from one pixel in eachdimension up to the size of its screen.However, you can use the \fBwm minsize\fR and \fBwm maxsize\fR commandsto limit the range of allowable sizes.The range set by \fBwm minsize\fR and \fBwm maxsize\fR applies toall forms of resizing, including the window's natural size aswell as manual resizes and the \fBwm geometry\fR command.You can also use the command \fBwm resizable\fR to completelydisable interactive resizing in one or both dimensions..SH "GRIDDED GEOMETRY MANAGEMENT".PPGridded geometry management occurs when one of the widgets of anapplication supports a range of useful sizes.This occurs, for example, in a text editor where the scrollbars,menus, and other adornments are fixed in size but the edit widgetcan support any number of lines of text or characters per line.In this case, it is usually desirable to let the user specify thenumber of lines or characters-per-line, either with the\fBwm geometry\fR command or by interactively resizing the window.In the case of text, and in other interesting cases also, onlydiscrete sizes of the window make sense, such as integral numbersof lines and characters-per-line; arbitrary pixel sizes are not useful..PPGridded geometry management provides support for this kind ofapplication.Tk (and the window manager) assume that there is a grid of somesort within the application and that the application should beresized in terms of \fIgrid units\fR rather than pixels.Gridded geometry management is typically invoked by turning onthe \fBsetGrid\fR option for a widget; it can also be invokedwith the \fBwm grid\fR command or by calling \fBTk_SetGrid\fR.In each of these approaches the particular widget (or sometimescode in the application as a whole) specifies the relationship between integral grid sizes for the window and pixel sizes.To return to non-gridded geometry management, invoke\fBwm grid\fR with empty argument strings..PPWhen gridded geometry management is enabled then all the dimensions specifiedin \fBwm minsize\fR, \fBwm maxsize\fR, and \fBwm geometry\fR commandsare treated as grid units rather than pixel units.Interactive resizing is also carried out in even numbers of grid unitsrather than pixels..SH BUGS.PPMost existing window managers appear to have bugs that affect theoperation of the \fBwm\fR command. For example, some changes won'ttake effect if the window is already active: the window will haveto be withdrawn and de-iconified in order to make the change happen..SH KEYWORDSaspect ratio, deiconify, focus model, geometry, grid, group, icon, iconify, increments, position, size, title, top-level window, units, window manager
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -