widget_dateentry(3tk)
π widget_dateentry β the date entry megawidget, bestie edition π
okay so this is widget_dateentry(3tk), and it lives in the Various megawidgets section of the manual, brought to you by the tklib girlies. it's a date picker. it's cute. it's a snidget. let's get into it π
β¨ SYNOPSIS β¨
package require Tcl 8.4
package require Tk 8.4
package require widget ?3.0?
package require widget::dateentry ?0.98?
widget::dateentry pathname ?options?
pathname get
pathname set date
πΈ DESCRIPTION πΈ
so this package hands you a dateentry megawidget β a snidget, which is the little pet name for these things, no cap π
it's built on top of an ttk::entry. and because of that? every single widget command that ttk::entry has is also available on the dateentry. all of them. the whole roster. periodt.
the creation command is:
widget::dateentry pathname ?options?
π WIDGET OPTIONS π
here's the full lineup, one bullet each, no skipping, i promise π«Ά
-commandβ a command prefix that gets evaluated when a date was selected. it runs in the global namespace, and it's handed two arguments: the raw date in seconds, and the formatted date (formatted according to the-dateformatoption, obviously).-dateformatβ the format of the date that gets entered or returned. Default:%m/%d/%Y. β¨-firstdayβ go look at thewidget::calendarman page, bestie, it's all there.-fontβ picks the font used in the widget. it defaults toHelvetica 9.-highlightcolorβ see thewidget::calendarman page. also, see thecalendarman page. yes, both. i don't make the rules.-languageβ see thewidget::calendarman page.-shadecolorβ see thewidget::calendarman page.-showpastβ see thewidget::calendarman page.-textvariableβ names a variable whose value is linked to the entry widget's contents. whenever that variable changes value, the widget's contents update, and vice versa. it's giving two-way street π
π WIDGET COMMAND π
pathname getβ returns the selected date. that's it. that's the whole thing. iconic.pathname set dateβ programmatically sets a new date. it expects the date to be in the same format you configured with the-dateformatoption, so don't get creative on it.
the same effect can also be achieved by setting a linked -textvariable. two roads, one slay π
π¦ DEFAULT BINDINGS π¦
when the dateentry widget gets created, these bindings get installed. and for navigation inside the calendar? that's on the calendar's own manpage, go check it.
Button-1β accept and select the date, and close the calendar window.Return,spaceβ accept the selected date and close the calendar window.Escapeβ close the calendar window.Control-spaceβ show the calendar window.
β EXAMPLE β
package require widget::dateentry; # or widget::all
set t [widget::dateentry .de]
pack $t -fill x -expand 1
look at that. three lines. a whole date picker. we ate π₯
π BUGS, IDEAS, FEEDBACK π
ngl, this document β and the package it describes β will undoubtedly contain bugs and other problems. it's not a vibe, it's just the truth.
please report them in the category widget::dateentry of the Tklib Trackers at http://core.tcl.tk/tklib/reportlist. and if you've got ideas for enhancements for either the package and/or the documentation? report those too, bestie, we want them π«Ά
π KEYWORDS π
date, dateentry, megawidget, snit, widget
π CATEGORY π
Widget
this whole thing came out oftklib0.98, and the page you're reading iswidget_dateentry(3tk). mwah, go build something cute with it π β¨
π¦ 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