widget.html
来自「perl教程」· HTML 代码 · 共 854 行 · 第 1/3 页
HTML
854 行
1.25 on a 72 dpi monitor would cause everything in the application to be
displayed 1.25 times as large as normal. The initial value for the scaling
factor is set when the application starts, based on properties of the
installed monitor (as reported via the window system),
but it can be changed at any time. Measurements made
after the scaling factor is changed will use the new scaling factor, but it
is undefined whether existing widgets will resize themselves dynamically to
accomodate the new scaling factor.</p>
</dd>
</li>
<dt><strong><a name="item_screen"><em>$widget</em>-><strong>screen</strong></a></strong>
<dd>
<p>Returns the name of the screen associated with <em>$widget</em>, in
the form <em>displayName</em>.<em>screenIndex</em>.</p>
</dd>
</li>
<dt><strong><a name="item_screencells"><em>$widget</em>-><strong>screencells</strong></a></strong>
<dd>
<p>Returns a decimal string giving the number of cells in the default
color map for <em>$widget</em>'s screen.</p>
</dd>
</li>
<dt><strong><a name="item_screendepth"><em>$widget</em>-><strong>screendepth</strong></a></strong>
<dd>
<p>Returns a decimal string giving the depth of the root window
of <em>$widget</em>'s screen (number of bits per pixel).</p>
</dd>
</li>
<dt><strong><a name="item_screenheight"><em>$widget</em>-><strong>screenheight</strong></a></strong>
<dd>
<p>Returns a decimal string giving the height of <em>$widget</em>'s screen,
in pixels.</p>
</dd>
</li>
<dt><strong><a name="item_screenmmheight"><em>$widget</em>-><strong>screenmmheight</strong></a></strong>
<dd>
<p>Returns a decimal string giving the height of <em>$widget</em>'s screen,
in millimeters.</p>
</dd>
</li>
<dt><strong><a name="item_screenmmwidth"><em>$widget</em>-><strong>screenmmwidth</strong></a></strong>
<dd>
<p>Returns a decimal string giving the width of <em>$widget</em>'s screen,
in millimeters.</p>
</dd>
</li>
<dt><strong><a name="item_screenvisual"><em>$widget</em>-><strong>screenvisual</strong></a></strong>
<dd>
<p>Returns one of the following strings to indicate the default visual
class for <em>$widget</em>'s screen: <strong>directcolor</strong>, <strong>grayscale</strong>,
<strong>pseudocolor</strong>, <strong>staticcolor</strong>, <strong>staticgray</strong>, or
<strong>truecolor</strong>.</p>
</dd>
</li>
<dt><strong><a name="item_screenwidth"><em>$widget</em>-><strong>screenwidth</strong></a></strong>
<dd>
<p>Returns a decimal string giving the width of <em>$widget</em>'s screen,
in pixels.</p>
</dd>
</li>
<dt><strong><a name="item_server"><em>$widget</em>-><strong>server</strong></a></strong>
<dd>
<p>Returns a string containing information about the server for
<em>$widget</em>'s display. The exact format of this string may vary
from platform to platform. For X servers the string
has the form ``<strong>X</strong><em>major</em><strong>R</strong><em>minor vendor vendorVersion</em>''
where <em>major</em> and <em>minor</em> are the version and revision
numbers provided by the server (e.g., <strong>X11R5</strong>), <em>vendor</em>
is the name of the vendor for the server, and <em>vendorRelease</em>
is an integer release number provided by the server.</p>
</dd>
</li>
<dt><strong><a name="item_toplevel"><em>$widget</em>-><strong>toplevel</strong></a></strong>
<dd>
<p>Returns the reference of the top-level window containing <em>$widget</em>.</p>
</dd>
</li>
<dt><strong><a name="item_unmapwindow"><em>$widget</em>-><strong>UnmapWindow</strong></a></strong>
<dd>
<p>Cause <em>$widget</em> to be "unmapped" i.e. removed from the display.
This does for any widget what <em>$widget</em>->withdraw does for
toplevel widgets. May confuse the geometry manager (pack, grid, place, ...)
that thinks it is managing the widget.</p>
</dd>
</li>
<dt><strong><a name="item_update"><em>$widget</em>-><strong>update</strong></a></strong>
<dd>
<p>One of two methods which are used to bring the application ``up to date''
by entering the event loop repeated until all pending events
(including idle callbacks) have been processed.</p>
</dd>
<dd>
<p>The <strong>update</strong> method is useful in scripts where you are performing a
long-running computation but you still want the application to respond
to events such as user interactions; if you occasionally call
<strong>update</strong> then user input will be processed during the next call to
<strong>update</strong>.</p>
</dd>
</li>
<dt><strong><a name="item_unbusy"><em>$widget</em>-><strong>Unbusy</strong></a></strong>
<dd>
<p>Restores widget state after a call to <em>$widget</em>-><strong>Busy</strong>.</p>
</dd>
</li>
<dt><strong><a name="item_viewable"><em>$widget</em>-><strong>viewable</strong></a></strong>
<dd>
<p>Returns 1 if <em>$widget</em> and all of its ancestors up through the
nearest toplevel window are mapped. Returns 0 if any of these
windows are not mapped.</p>
</dd>
</li>
<dt><strong><a name="item_visual"><em>$widget</em>-><strong>visual</strong></a></strong>
<dd>
<p>Returns one of the following strings to indicate the visual
class for <em>$widget</em>: <strong>directcolor</strong>, <strong>grayscale</strong>,
<strong>pseudocolor</strong>, <strong>staticcolor</strong>, <strong>staticgray</strong>, or
<strong>truecolor</strong>.</p>
</dd>
</li>
<dt><strong><a name="item_visualid"><em>$widget</em>-><strong>visualid</strong></a></strong>
<dd>
<p>Returns the X identifier for the visual for $widget.</p>
</dd>
</li>
<dt><strong><a name="item_visualsavailable"><em>$widget</em>-><strong>visualsavailable</strong>(?<strong>includeids</strong>?)</a></strong>
<dd>
<p>Returns a list whose elements describe the visuals available for
<em>$widget</em>'s screen.
Each element consists of a visual class followed by an integer depth.
The class has the same form as returned by <em>$widget</em>-><strong>visual</strong>.
The depth gives the number of bits per pixel in the visual.
In addition, if the <strong>includeids</strong> argument is provided, then the
depth is followed by the X identifier for the visual.</p>
</dd>
</li>
<dt><strong><a name="item_vrootheight"><em>$widget</em>-><strong>vrootheight</strong></a></strong>
<dd>
<p>Returns the height of the virtual root window associated with <em>$widget</em>
if there is one; otherwise returns the height of <em>$widget</em>'s screen.</p>
</dd>
</li>
<dt><strong><a name="item_vrootwidth"><em>$widget</em>-><strong>vrootwidth</strong></a></strong>
<dd>
<p>Returns the width of the virtual root window associated with <em>$widget</em>
if there is one; otherwise returns the width of <em>$widget</em>'s screen.</p>
</dd>
</li>
<dt><strong><a name="item_vrootx"><em>$widget</em>-><strong>vrootx</strong></a></strong>
<dd>
<p>Returns the x-offset of the virtual root window associated with <em>$widget</em>,
relative to the root window of its screen.
This is normally either zero or negative.
Returns 0 if there is no virtual root window for <em>$widget</em>.</p>
</dd>
</li>
<dt><strong><a name="item_vrooty"><em>$widget</em>-><strong>vrooty</strong></a></strong>
<dd>
<p>Returns the y-offset of the virtual root window associated with <em>$widget</em>,
relative to the root window of its screen.
This is normally either zero or negative.
Returns 0 if there is no virtual root window for <em>$widget</em>.</p>
</dd>
</li>
<dt><strong><a name="item_waitvariable"><em>$widget-</em>><strong>waitVariable</strong>(\$<em>name</em>)</a></strong>
<dt><strong><a name="item_waitvisibility"><em>$widget-</em>><strong>waitVisibility</strong></a></strong>
<dt><strong><a name="item_waitwindow"><em>$widget-</em>><strong>waitWindow</strong></a></strong>
<dd>
<p>The <strong>tk wait</strong> methods wait for one of several things to happen,
then it returns without taking any other actions.
The return value is always an empty string.
<strong>waitVariable</strong> expects a reference to a perl
variable and the command waits for that variable to be modified.
This form is typically used to wait for a user to finish interacting
with a dialog which sets the variable as part (possibly final)
part of the interaction.
<strong>waitVisibility</strong> waits for a change in <em>$widget</em>'s
visibility state (as indicated by the arrival of a VisibilityNotify
event). This form is typically used to wait for a newly-created
window to appear on the screen before taking some action.
<strong>waitWindow</strong> waits for <em>$widget</em> to be destroyed.
This form is typically used to wait for a user to finish interacting
with a dialog box before using the result of that interaction.
Note that creating and destroying the window each time a dialog is required
makes code modular but imposes overhead which can be avoided by <strong>withdrawing</strong>
the window instead and using <strong>waitVisibility</strong>.</p>
</dd>
<dd>
<p>While the <strong>tk wait</strong> methods are waiting they processes events in
the normal fashion, so the application will continue to respond
to user interactions.
If an event handler invokes <strong>tkwait</strong> again, the nested call
to <strong>tkwait</strong> must complete before the outer call can complete.</p>
</dd>
</li>
<dt><strong><a name="item_width"><em>$widget</em>-><strong>width</strong></a></strong>
<dd>
<p>Returns a decimal string giving <em>$widget</em>'s width in pixels.
When a window is first created its width will be 1 pixel; the
width will eventually be changed by a geometry manager to fulfill
the window's needs.
If you need the true width immediately after creating a widget,
invoke <strong>update</strong> to force the geometry manager to arrange it,
or use <em>$widget</em>-><strong>reqwidth</strong> to get the window's requested width
instead of its actual width.</p>
</dd>
</li>
<dt><strong><a name="item_useinputmethods"><em>$widget</em>-><strong>useinputmethods</strong>( ?boolean? );</a></strong>
<dd>
<p>Sets and queries the state of whether Tk should use XIM (X Input
Methods) for filtering events. The resulting state is returned.
XIM is used in some locales (ie: Japanese, Korean), to handle
special input devices. This feature is only significant on X.
If XIM support is not available, this will always return 0.
If the boolean argument is omitted, the current state is
returned. This is turned on by default for the main display.</p>
</dd>
</li>
<dt><strong><a name="item_windowingsystem"><em>$widget</em>-><strong>windowingsystem</strong>;</a></strong>
<dd>
<p>Returns the current Tk windowing system, one of <strong>x11</strong> (X11-based),
<strong>win32</strong> (MS Windows), <strong>classic</strong> (Mac OS Classic), or <strong>aqua</strong> (Mac OS X Aqua).</p>
</dd>
</li>
<dt><strong><a name="item_x"><em>$widget</em>-><strong>x</strong></a></strong>
<dd>
<p>Returns a decimal string giving the x-coordinate, in <em>$widget</em>'s
parent, of the upper-left corner of <em>$widget</em>'s border (or <em>$widget</em>
if it has no border).</p>
</dd>
</li>
<dt><strong><a name="item_y"><em>$widget</em>-><strong>y</strong></a></strong>
<dd>
<p>Returns a decimal string giving the y-coordinate, in <em>$widget</em>'s
parent, of the
upper-left corner of <em>$widget</em>'s border (or <em>$widget</em> if it
has no border).</p>
</dd>
</li>
</dl>
<p>
</p>
<hr />
<h1><a name="caveats">CAVEATS</a></h1>
<p>The above documentaion on generic methods is incomplete.</p>
<p>
</p>
<hr />
<h1><a name="keywords">KEYWORDS</a></h1>
<p>atom, children, class, geometry, height, identifier, information, interpreters,
mapped, parent, path name, screen, virtual root, width, window</p>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?