[ Tklib Home | Main Table Of Contents | Table Of Contents | Keyword Index | Categories | Modules | Applications ]

datefield(n) 0.2 tklib "Tk datefield widget"


datefield - Tk datefield widget

Table Of Contents


  • package require Tk
  • package require datefield ?0.2?


The datefield package provides the datefield widget which is an enhanced text entry widget for the purpose of date entry. Only valid dates of the form MM/DD/YYYY can be entered.

The datefield widget is, in fact, just an entry widget with specialized bindings. This means all the command and options for an entry widget apply equally here.


::datefield::datefield widgetpath ?options?

Creates and configures a date field widget.


See the entry manual entry for details on all available options.


 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
 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

Bugs, Ideas, Feedback

This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category datefield of the Tklib Trackers. Please also report any ideas for enhancements you may have for either package and/or documentation.

See Also

clock(n), entry(n)


clock, date, dateentry, entry, widget