You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
325 lines
8.8 KiB
HTML
325 lines
8.8 KiB
HTML
15 years ago
|
<TITLE>watch - Create and manipulate time with a watch widgets</TITLE>
|
||
|
<H1>watch - Create and manipulate time with a watch widgets</H1>
|
||
|
|
||
|
</pre><H2>SYNOPSIS</H2>
|
||
|
<B>watch<I> <I>pathName </I>?<I>options</I>?
|
||
|
</pre><H2>INHERITANCE</H2>
|
||
|
itk::Widget <- Watch
|
||
|
|
||
|
</pre><H2>STANDARD OPTIONS</H2>
|
||
|
<P>
|
||
|
<table cellpadding=5>
|
||
|
<td valign=top>
|
||
|
<B>background</B><br>
|
||
|
</td>
|
||
|
<td valign=top>
|
||
|
<B>cursor</B><br>
|
||
|
</td>
|
||
|
<td valign=top>
|
||
|
<B>foreground</B><br>
|
||
|
</td>
|
||
|
<td valign=top>
|
||
|
<B>relief</B><br>
|
||
|
</td>
|
||
|
</table>
|
||
|
<P>
|
||
|
See the <A HREF="http://www.sco.com/Technology/tcl/man/tk_man/options.n.html"> "options" </A> manual entry for details on the standard options.
|
||
|
</pre><H2>ASSOCIATED OPTIONS</H2>
|
||
|
<P>
|
||
|
See the "Canvas" manual entry for details on the above associated options.
|
||
|
|
||
|
</pre><H2>WIDGET-SPECIFIC OPTIONS</H2>
|
||
|
<P>
|
||
|
<pre>
|
||
|
Name: <B>clockColor</B>
|
||
|
Class: <B>ColorfR
|
||
|
Command-Line Switch: <B>-clockcolor</B>
|
||
|
</pre>
|
||
|
<UL>
|
||
|
Fill color for the main oval encapsulating the watch, in any of the forms
|
||
|
acceptable to <B>Tk_GetColor</B>. The default is "White".
|
||
|
</UL>
|
||
|
<table cellpadding=5>
|
||
|
<td valign=top>
|
||
|
<P><br>
|
||
|
<B>BitmapfR<br>
|
||
|
</td>
|
||
|
<td valign=top>
|
||
|
Name:<br>
|
||
|
Command-Line<br>
|
||
|
</td>
|
||
|
<td valign=top>
|
||
|
<B>clockStipple</B><br>
|
||
|
Switch:<br>
|
||
|
</td>
|
||
|
<td valign=top>
|
||
|
Class:<br>
|
||
|
<B>-clockstipple</B><br>
|
||
|
</td>
|
||
|
</table>
|
||
|
<UL>
|
||
|
Bitmap for the main oval encapsulating the watch, in any of the forms
|
||
|
acceptable to <B>Tk_GetBitmap</B>. The default is "".
|
||
|
</UL>
|
||
|
<P>
|
||
|
<pre>
|
||
|
Name: <B>height</B>
|
||
|
Class: <B>Height</B>
|
||
|
Command-Line Switch: <B>-height</B>
|
||
|
</pre>
|
||
|
<UL>
|
||
|
Specifies the height of the watch widget in any of the forms
|
||
|
acceptable to <B>Tk_GetPixels</B>. The default height is 175 pixels.
|
||
|
</UL>
|
||
|
<P>
|
||
|
<pre>
|
||
|
Name: <B>hourColor</B>
|
||
|
Class: <B>ColorfR
|
||
|
Command-Line Switch: <B>-hourcolor</B>
|
||
|
</pre>
|
||
|
<UL>
|
||
|
Fill color for the hour hand, in any of the forms acceptable to <B>Tk_GetColor</B>.
|
||
|
The default is "Red".
|
||
|
</UL>
|
||
|
<P>
|
||
|
<pre>
|
||
|
Name: <B>hourRadius</B>
|
||
|
Class: <B>Radius</B>
|
||
|
Command-Line Switch: <B>-hourradius</B>
|
||
|
</pre>
|
||
|
<UL>
|
||
|
Specifies the radius of the hour hand as a percentage of the radius
|
||
|
from the center to the out perimeter of the clock.
|
||
|
The value must be a fraction <= 1. The default is ".5".
|
||
|
</UL>
|
||
|
<P>
|
||
|
<pre>
|
||
|
Name: <B>minuteColor</B>
|
||
|
Class: <B>ColorfR
|
||
|
Command-Line Switch: <B>-minutecolor</B>
|
||
|
</pre>
|
||
|
<UL>
|
||
|
Fill color for the minute hand, in any of the forms acceptable to <B>Tk_GetColor</B>.
|
||
|
The default is "Yellow".
|
||
|
</UL>
|
||
|
<P>
|
||
|
<pre>
|
||
|
Name: <B>minuteRadius</B>
|
||
|
Class: <B>Radius</B>
|
||
|
Command-Line Switch: <B>-minuteradius</B>
|
||
|
</pre>
|
||
|
<UL>
|
||
|
Specifies the radius of the minute hand as a percentage of the radius
|
||
|
from the center to the out perimeter of the clock.
|
||
|
The value must be a fraction <= 1. The default is ".8".
|
||
|
</UL>
|
||
|
<P>
|
||
|
<pre>
|
||
|
Name: <B>pivotColor</B>
|
||
|
Class: <B>ColorfR
|
||
|
Command-Line Switch: <B>-pivotcolor</B>
|
||
|
</pre>
|
||
|
<UL>
|
||
|
Fill color for the circle in which the watch hands rotate
|
||
|
in any of the forms acceptable to <B>Tk_GetColor</B>.
|
||
|
The default is "White".
|
||
|
</UL>
|
||
|
<P>
|
||
|
<pre>
|
||
|
Name: <B>pivotRadius</B>
|
||
|
Class: <B>Radius</B>
|
||
|
Command-Line Switch: <B>-pivotradius</B>
|
||
|
</pre>
|
||
|
<UL>
|
||
|
Specifies the radius of the circle in which the watch hands rotate
|
||
|
as a percentage of the radius. The value must be a fraction <= 1.
|
||
|
The default is ".1".
|
||
|
</UL>
|
||
|
<P>
|
||
|
<pre>
|
||
|
Name: <B>secondColor</B>
|
||
|
Class: <B>ColorfR
|
||
|
Command-Line Switch: <B>-secondcolor</B>
|
||
|
</pre>
|
||
|
<UL>
|
||
|
Fill color for the second hand, in any of the forms acceptable to <B>Tk_GetColor</B>.
|
||
|
The default is "Black".
|
||
|
</UL>
|
||
|
<P>
|
||
|
<pre>
|
||
|
Name: <B>secondRadius</B>
|
||
|
Class: <B>Radius</B>
|
||
|
Command-Line Switch: <B>-secondradius</B>
|
||
|
</pre>
|
||
|
<UL>
|
||
|
Specifies the radius of the second hand as a percentage of the radius
|
||
|
from the center to the out perimeter of the clock.
|
||
|
The value must be a fraction <= 1. The default is ".9".
|
||
|
</UL>
|
||
|
<P>
|
||
|
<pre>
|
||
|
Name: <B>showAmPm</B>
|
||
|
Class: <B>ShosAmPm</B>
|
||
|
Command-Line Switch: <B>-showampm</B>
|
||
|
</pre>
|
||
|
<UL>
|
||
|
Specifies whether the AM/PM radiobuttons should be displayed, in any
|
||
|
of the forms acceptable to <B>Tcl_GetBoolean</B>. The default is yes.
|
||
|
</UL>
|
||
|
<P>
|
||
|
<pre>
|
||
|
Name: <B>state</B>
|
||
|
Class: <B>State</B>
|
||
|
Command-Line Switch: <B>-state</B>
|
||
|
</pre>
|
||
|
<UL>
|
||
|
Specifies the editable state for the hands on the watch. In a normal
|
||
|
state, the user can select and move the hands via mouse button 1. The
|
||
|
valid values are <B>normal</B>, and <B>disabled</B>. The defult is normal.
|
||
|
</UL>
|
||
|
<P>
|
||
|
<pre>
|
||
|
Name: <B>tickColor</B>
|
||
|
Class: <B>ColorfR
|
||
|
Command-Line Switch: <B>-tickcolor</B>
|
||
|
</pre>
|
||
|
<UL>
|
||
|
Fill color for the 60 ticks around the perimeter of the watch,
|
||
|
in any of the forms acceptable to <B>Tk_GetColor</B>. The default is "Black".
|
||
|
</UL>
|
||
|
<P>
|
||
|
<pre>
|
||
|
Name: <B>width</B>
|
||
|
Class: <B>Width</B>
|
||
|
Command-Line Switch: <B>-width</B>
|
||
|
</pre>
|
||
|
<UL>
|
||
|
Specifies the width of the watch widget in any of the forms
|
||
|
acceptable to <B>Tk_GetPixels</B>. The default height is 155 pixels.
|
||
|
</UL>
|
||
|
</pre><HR>
|
||
|
|
||
|
</pre><H2>DESCRIPTION</H2>
|
||
|
<P>
|
||
|
|
||
|
The <B>watch</B> command creates a watch with hour, minute, and
|
||
|
second hands modifying the time value.
|
||
|
|
||
|
</pre><H2>METHODS</H2>
|
||
|
<P>
|
||
|
The <B>watch</B> command creates a new Tcl command whose
|
||
|
name is <I>pathName</I>. This command may be used to invoke various
|
||
|
operations on the widget. It has the following general form:
|
||
|
<pre>
|
||
|
<I>pathName option </I>?<I>arg arg ...</I>?
|
||
|
</pre>
|
||
|
<I>Option</I> and the <I>arg</I>s
|
||
|
determine the exact behavior of the command. The following
|
||
|
commands are possible for watch widgets:
|
||
|
|
||
|
</pre><H2>WIDGET-SPECIFIC METHODS</H2>
|
||
|
<DL>
|
||
|
<DT> <I>pathName <B>cget</B> <I>option</I>
|
||
|
</I></B>
|
||
|
<DD> Returns the current value of the configuration option given
|
||
|
by <I>option</I>.
|
||
|
<I>Option</I> may have any of the values accepted by the <B>watch</B>
|
||
|
command.
|
||
|
</DL>
|
||
|
<DL>
|
||
|
<DT> <I>pathName</I> <B>configure</B> ?<I>option</I>? ?<I>value option value ...</I>?
|
||
|
</I></B>
|
||
|
<DD> Query or modify the configuration options of the widget.
|
||
|
If no <I>option</I> is specified, returns a list describing all of
|
||
|
the available options for <I>pathName</I> (see <B>Tk_ConfigureInfo</B> for
|
||
|
information on the format of this list). If <I>option</I> is specified
|
||
|
with no <I>value</I>, then the command returns a list describing the
|
||
|
one named option (this list will be identical to the corresponding
|
||
|
sublist of the value returned if no <I>option</I> is specified). If
|
||
|
one or more <I>option-value</I> pairs are specified, then the command
|
||
|
modifies the given widget option(s) to have the given value(s); in
|
||
|
this case the command returns an empty string.
|
||
|
<I>Option</I> may have any of the values accepted by the <B>watch</B>
|
||
|
command.
|
||
|
</DL>
|
||
|
<DL>
|
||
|
<DT> <I>pathName <B>get</B> ?<B>format</B>?
|
||
|
</I></B>
|
||
|
<DD> Returns the current time of the watch in a format of
|
||
|
string or as an integer clock value using the <B>-string</B> and <B>-clicks</B>
|
||
|
format options respectively. The default is by string. Reference the
|
||
|
clock command for more information on obtaining time and its
|
||
|
formats.
|
||
|
</DL>
|
||
|
<DL>
|
||
|
<DT> <I>pathName <B>show</B> <I>time</I>
|
||
|
</I></B>
|
||
|
<DD> Changes the currently displayed time to be that of the time
|
||
|
argument. The time may be specified either as a string, an
|
||
|
integer clock value or the keyword "now". Reference the clock
|
||
|
command for more information on obtaining time and its format.
|
||
|
</DL>
|
||
|
<DL>
|
||
|
<DT> <I>pathName <B>watch</B> ?<B>args</B>?
|
||
|
</I></B>
|
||
|
<DD> Evaluates the specifieds <B>args</B> against the canvas component.
|
||
|
|
||
|
</DL>
|
||
|
</pre><H2>COMPONENTS</H2>
|
||
|
<P>
|
||
|
<pre>
|
||
|
Name: <B>canvas</B>
|
||
|
Class: <B>Canvas</B>
|
||
|
</pre>
|
||
|
<UL>
|
||
|
The canvas component is the where the clock is drawn. See the
|
||
|
Canvas widget manual entry for details.
|
||
|
</UL>
|
||
|
<P>
|
||
|
<pre>
|
||
|
Name: <B>frame</B>
|
||
|
Class: <B>Frame</B>
|
||
|
</pre>
|
||
|
<UL>
|
||
|
The frame component is the where the "AM" and "PM" radiobuttons are displayed.
|
||
|
See the Frame widget manual entry for details.
|
||
|
</UL>
|
||
|
<P>
|
||
|
<pre>
|
||
|
Name: <B>am</B>
|
||
|
Class: <B>Radiobutton</B>
|
||
|
</pre>
|
||
|
<UL>
|
||
|
The am component indicates whether on not the time is relative to "AM".
|
||
|
See the Radiobutton widget manual entry for details.
|
||
|
</UL>
|
||
|
<P>
|
||
|
<pre>
|
||
|
Name: <B>pm</B>
|
||
|
Class: <B>Radiobutton</B>
|
||
|
</pre>
|
||
|
<UL>
|
||
|
The pm component indicates whether on not the time is relative to "PM".
|
||
|
See the Radiobutton widget manual entry for details.
|
||
|
</UL>
|
||
|
</table>
|
||
|
|
||
|
</pre><H2>EXAMPLE</H2>
|
||
|
<pre>
|
||
|
watch .w -state disabled -showampm no -width 155 -height 155
|
||
|
pack .w -padx 10 -pady 10 -fill both -expand yes
|
||
|
|
||
|
while {1} {
|
||
|
after 1000
|
||
|
.w show
|
||
|
update
|
||
|
}
|
||
|
</pre>
|
||
|
</pre><H2>AUTHORS</H2>
|
||
|
John Tucker
|
||
|
<P>
|
||
|
Mark L. Ulferts
|
||
|
</pre><H2>KEYWORDS</H2>
|
||
|
watch, hand, ticks, pivot, widget
|
||
|
|