iwidgets::watch(1)
β¨ iwidgets::watch β the [incr Widgets] manual page, bestie edition β¨
okay so. picture this: you want a whole entire clock β hour hand, minute hand, second hand, the works β living inside your Tk app, and you want to poke at it and move the hands around with your mouse. that's iwidgets::watch(1), and it is so much fun, no cap. let's get into it. π
πΈ NAME πΈ
iwidgets::watch β create and manipulate time with a watch widgets
π SYNOPSIS π
iwidgets::watch pathName ?options?
π¦ INHERITANCE π¦
itk::Widget <- iwidgets::Watch
(so it's giving Widget energy, but make it Watch π )
β STANDARD OPTIONS β
backgroundcursorforegroundrelief
See the options manual entry for details on the standard options. β¨
π ASSOCIATED OPTIONS π
See the Canvas manual entry for details on the above associated options.
(yeah bestie, the above. the page said it, not me. π)
π WIDGET-SPECIFIC OPTIONS π
-clockcolorβ Name:clockColor, Class:ColorfR. the fill color for the main oval that wraps the whole watch up, in any of the forms acceptable toTk_GetColor. default is"White". π«Ά-clockstippleβ Name:clockStipple, Class:BitmapfR. the bitmap for that main oval encapsulating the watch, in any of the forms acceptable toTk_GetBitmap. default is""(so, nothing, empty, a blank canvas of vibes).-heightβ Name:height, Class:Height. tells you how tall the watch widget is, in any of the forms acceptable toTk_GetPixels. the default height is 175 pixels. π-hourcolorβ Name:hourColor, Class:ColorfR. fill color for the hour hand, in any of the forms acceptable toTk_GetColor. default is"Red". π₯-hourradiusβ Name:hourRadius, Class:Radius. the radius of the hour hand, expressed as a percentage of the radius from the center out to the outer perimeter of the clock. the value must be a fraction<= 1. default is".5".-minutecolorβ Name:minuteColor, Class:ColorfR. fill color for the minute hand, in any of the forms acceptable toTk_GetColor. default is"Yellow". π-minuteradiusβ Name:minuteRadius, Class:Radius. the radius of the minute hand as a percentage of the radius from the center out to the outer perimeter of the clock. the value must be a fraction<= 1. default is".8".-pivotcolorβ Name:pivotColor, Class:ColorfR. fill color for the little circle where the watch hands rotate, in any of the forms acceptable toTk_GetColor. default is"White". βͺ-pivotradiusβ Name:pivotRadius, Class:Radius. the radius of that circle where the hands rotate, as a percentage of the radius. the value must be a fraction<= 1. default is".1".-secondcolorβ Name:secondColor, Class:ColorfR. fill color for the second hand, in any of the forms acceptable toTk_GetColor. default is"Black". π€-secondradiusβ Name:secondRadius, Class:Radius. the radius of the second hand as a percentage of the radius from the center out to the outer perimeter of the clock. the value must be a fraction<= 1. default is".9".-showampmβ Name:showAmPm, Class:ShosAmPm. says whether the AM/PM radiobuttons should show up, in any of the forms acceptable toTcl_GetBoolean. default isyes. π-stateβ Name:state, Class:State. the editable state for the hands on the watch. when it's in a normal state, the user can select the hands and move them around using mouse button 1. the valid values arenormalanddisabled. the default isnormal. π-tickcolorβ Name:tickColor, Class:ColorfR. fill color for the 60 ticks going around the perimeter of the watch, in any of the forms acceptable toTk_GetColor. default is"Black".-widthβ Name:width, Class:Width. specifies the width of the watch widget in any of the forms acceptable toTk_GetPixels. and the default height is 155 pixels. (yes. height. the page said height. i'm just the messenger, bestie π). π
π DESCRIPTION π
the iwidgets::watch command creates a watch β like, an actual watch β with hour, minute, and second hands, and it modifies the time value. that's the whole vibe. ticking, hands, slay. β¨
π§ METHODS π§
the iwidgets::watch command creates a brand new Tcl command whose name is pathName. you use this command to invoke all sorts of operations on the widget. it has this general form:
pathName option ?arg arg ...?
option and the args decide the exact behavior of the command. the following commands are possible for watch widgets:
π WIDGET-SPECIFIC METHODS π
pathName cget option
returns the current value of the configuration option given by option. option may have any of the values accepted by the iwidgets::watch command.
pathName configure ?option? ?value option value ...?
query or modify the configuration options of the widget. if no option is specified, it returns a list describing all of the available options for pathName (see Tk_ConfigureInfo for info on the format of this list, iykyk). if option is specified with no value, then the command returns a list describing that one named option (this list will be identical to the corresponding sublist of the value returned when no option is specified). if one or more option-value pairs are specified, then the command modifies the given widget option(s) to have the given value(s) β and in that case the command returns an empty string. option may have any of the values accepted by the iwidgets::watch command.
pathName get ?format?
returns the current time of the watch, either as a format of string or as an integer clock value, using the -string and -clicks format options respectively. the default is by string. go reference the clock command for more info on obtaining time and its formats. β°
pathName show time
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 info on obtaining time and its format.
pathName watch ?args?
evaluates the specified args against the canvas component.
πΈ COMPONENTS πΈ
canvasβ Name:canvas, Class:Canvas. the canvas component is where the clock is drawn. see theCanvaswidget manual entry for details. π¨frameβ Name:frame, Class:Frame. the frame component is where the"AM"and"PM"radiobuttons are displayed. see theFramewidget manual entry for details.amβ Name:am, Class:Radiobutton. the am component indicates whether or not the time is relative to"AM". see theRadiobuttonwidget manual entry for details.pmβ Name:pm, Class:Radiobutton. the pm component indicates whether or not the time is relative to"PM". see theRadiobuttonwidget manual entry for details.
π EXAMPLE π
here's the whole moment, exactly as it was written:
package require Iwidgets 4.0 iwidgets::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 }
π«Ά AUTHOR π«Ά
John Tucker Mark L. Ulferts
β KEYWORDS β
watch, hand, ticks, pivot, widget
heads up bestie: the watch widget is literally out here modifying the time value with its hands, so if you set-statetonormal, your users can grab those hands with mouse button 1 and drag.disabledis the vibe if you don't want that. π
and that's the page!! stay ticking, stay iconic. π¦
this one's from Tk and it's the iwidgets::watch(1) manual β that's the source and the version, bestie, and it's serving exactly the date it's serving. periodt. πβ¨ππ¦πΈπ
π«Ά
π¦ where this page comes from
- debian bookworm: iwidgets4-doc 4.1.1-2.1
- debian trixie: iwidgets4-doc 4.1.1-4
- ubuntu jammy: iwidgets4-doc 4.1.1-2.1
- ubuntu noble: iwidgets4-doc 4.1.1-2.1
- ubuntu resolute: iwidgets4-doc 4.1.1-4
- ubuntu stonking: iwidgets4-doc 4.1.1-4
- Copyright (c) 1995 DSC Technologies Corporation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms