datefield(3tk)

πŸ“¦
version 0.9 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– datefield β€” the Tk datefield widget (3tk) πŸ’–

okay bestie, gather round, we're doing the datefield manual page and it's actually so cute. this is datefield(3tk), manual page for the Tk datefield widget, and by the end you're gonna be entering dates like a whole icon. no cap. πŸŽ€


✨ NAME ✨

datefield β€” the Tk datefield widget. that's it, that's the name, she's simple and she knows it πŸ’…


✨ SYNOPSIS ✨

package require Tk

package require datefield ?0.3?

::datefield::datefield widgetpath ?options?

-format

like, that's the whole vibe check. <pink>package require Tk</pink>, then <pink>package require datefield</pink> and the version is optional (?0.3? β€” she'll take 0.3 or whatever, she's flexible 🫢), then you make the widget, then there's -format. that last one is literally just chilling there in the synopsis, we love an unbothered queen πŸ™ˆ


🌸 DESCRIPTION 🌸

the <purple>datefield</purple> package gives you the <purple>datefield</purple> widget, which is an enhanced text entry widget made specifically for the purpose of entering dates. it's giving "entry widget but she went to date school" ✨

there are three valid formats for the dates you can enter:

  1. the English form MM/DD/YYYY, which uses -format "%m/%d/%Y" β€” and this one is the default, bestie, she's the main character πŸ‘‘
  2. the German form DD.MM.YYYY, using -format "%d.%m.%Y"
  3. the ISO form YYYY-MM-DD, using -format "%Y-%m-%d"

and here's the tea πŸ“: the datefield widget is in fact just an <cyan>entry</cyan> widget with specialized bindings. which means all the commands and options for an entry widget apply equally here. every single one. so if you already know entry, you already know this. periodt πŸ’…


πŸ’œ COMMANDS πŸ’œ

  • ::datefield::datefield widgetpath ?options? β€” creates and configures a date field widget. that's her whole job and she does it flawlessly, no notes 🌈

✨ OPTIONS ✨

  • -format β€” one of "%m/%d/%Y" (English, and this is the default if the option is left out β€” she'll just assume, queen behaviour), "%d.%m.%Y" (German), or "%Y-%m-%d" (ISO).
also!! see the <cyan>entry</cyan> manual entry for the details on all remaining / available options, because like we said, she is an entry widget underneath, so all of those apply here too 🫢

πŸ¦‹ EXAMPLE πŸ¦‹

okay here's the whole thing in action, look at her go:

package require datefield

wm title . "Datefield example"
proc DayOfWeek {args} {
    set now [clock scan $::myDate]
    set ::myDate2 [clock format $now -format %A]
}
trace variable myDate w DayOfWeek

::datefield::datefield .df -textvariable myDate -format "%m/%d/%Y"
label .l1 -text "Enter a date:"   -anchor e
label .l2 -text "That date is a:" -anchor e
label .l3 -textvariable myDate2 -relief sunken -width 12

grid .l1 .df -sticky ew
grid .l2 .l3 -sticky ew
focus .df

like?? she loads the package, sets the window title with wm title . "Datefield example", defines a proc DayOfWeek that takes args, uses clock scan on $::myDate to get now, then clock format $now -format %A into ::myDate2, traces the variable myDate with w and DayOfWeek, makes the actual widget with -textvariable myDate and -format "%m/%d/%Y", drops in three labels, grids them with -sticky ew, and focus .df. chef's kiss πŸ”₯ she ATE and left no crumbs.


πŸ’€ BUGS, IDEAS, FEEDBACK πŸ’€

not to be dramatic but this document, and the package it describes, will undoubtedly contain bugs and other problems. it's giving "we're all just doing our best" 😭

please report such things in the category datefield of the Tklib Trackers at http://core.tcl.tk/tklib/reportlist. and please also report any ideas for enhancements you may have for either the package and/or the documentation. they genuinely want to hear it, bestie 🫢


🌈 SEE ALSO 🌈


⭐ KEYWORDS ⭐

clock, date, dateentry, entry, widget


πŸ‘‘ CATEGORY πŸ‘‘

Widget β€” she's a widget, she said what she said πŸ’…


Copyright (c) Keith Vetter <keith@ebook.gemstar.com>
Copyright (c) Thomas Wunderlich <tcl.tk@blindenfreizeiten.de>

and that's the page!! shoutout to tklib, version 0.3, dated datefield(3tk) β€” this whole thing comes to you courtesy of tklib 0.3, and honestly? iconic. go enter some dates, bestie, you're gonna slay πŸ’–βœ¨πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from