datefield(3tk)
π 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:
- the English form
MM/DD/YYYY, which uses-format "%m/%d/%Y"β and this one is the default, bestie, she's the main character π - the German form
DD.MM.YYYY, using-format "%d.%m.%Y" - 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 π
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
- debian trixie: tklib 0.9-1
- ubuntu questing: tklib 0.9-1
- ubuntu resolute: tklib 0.9-1build1
- ubuntu stonking: tklib 0.9-1build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms