widget_dateentry(3tk)

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

πŸ’– 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 -dateformat option, obviously).
  • -dateformat β€” the format of the date that gets entered or returned. Default: %m/%d/%Y. ✨
  • -firstday β€” go look at the widget::calendar man page, bestie, it's all there.
  • -font β€” picks the font used in the widget. it defaults to Helvetica 9.
  • -highlightcolor β€” see the widget::calendar man page. also, see the calendar man page. yes, both. i don't make the rules.
  • -language β€” see the widget::calendar man page.
  • -shadecolor β€” see the widget::calendar man page.
  • -showpast β€” see the widget::calendar man 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 -dateformat option, 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 of tklib 0.98, and the page you're reading is widget_dateentry(3tk). mwah, go build something cute with it πŸ’‹ ✨
πŸ“¦ where this page comes from