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 ⭐

  • background
  • cursor
  • foreground
  • relief

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 to Tk_GetColor. default is "White". 🫢
  • -clockstipple β€” Name: clockStipple, Class: BitmapfR. the bitmap for that main oval encapsulating the watch, in any of the forms acceptable to Tk_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 to Tk_GetPixels. the default height is 175 pixels. πŸ“
  • -hourcolor β€” Name: hourColor, Class: ColorfR. fill color for the hour hand, in any of the forms acceptable to Tk_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 to Tk_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 to Tk_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 to Tk_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 to Tcl_GetBoolean. default is yes. πŸ•
  • -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 are normal and disabled. the default is normal. πŸ’…
  • -tickcolor β€” Name: tickColor, Class: ColorfR. fill color for the 60 ticks going around the perimeter of the watch, in any of the forms acceptable to Tk_GetColor. default is "Black".
  • -width β€” Name: width, Class: Width. specifies the width of the watch widget in any of the forms acceptable to Tk_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 the Canvas widget manual entry for details. 🎨
  • frame β€” Name: frame, Class: Frame. the frame component is where the "AM" and "PM" radiobuttons are displayed. see the Frame widget manual entry for details.
  • am β€” Name: am, Class: Radiobutton. the am component indicates whether or not the time is relative to "AM". see the Radiobutton widget manual entry for details.
  • pm β€” Name: pm, Class: Radiobutton. the pm component indicates whether or not the time is relative to "PM". see the Radiobutton widget 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 -state to normal, your users can grab those hands with mouse button 1 and drag. disabled is 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