widget_calendar(3tk)
π widget_calendar β bestie, it's a calendar π
okay so this page lives in section 3tk of the manual (the Tk megawidget corner of the world), and it's all about widget_calendar, a whole Calendar Megawidget. yes. a calendar. in Tk. we're doing this. ποΈβ¨
πΈ NAME πΈ
widget_calendar β the Calendar Megawidget, aka your new favorite snidget π
β¨ SYNOPSIS β¨
package require Tcl 8.4
package require Tk 8.4
package require widget ?3.0?
package require widget::calendar ?1.0.2?
widget::calendar pathname ?options?
like, you need Tcl 8.4 and Tk 8.4 minimum, then the widget package (version 3.0 or later, if you're asking), then widget::calendar itself (version 1.0.2 or later, pls), and then you just... make one with a pathname and some options. that's it. that's the whole ritual. π
π¦ DESCRIPTION π¦
this package hands you a calendar megawidget β and yes, the official word for it is a snidget, which is iconic and I will not be taking questions. π«Ά
and here's the whole invocation, look at her:
widget::calendar pathname ?options?
π WIDGET OPTIONS π
every single one, no skips, we love a complete list:
-commandβ a script to evaluate when a date was selected. like, "hey bestie, they picked a day" energy. π-dateformatβ the format of the date that gets returned. default:%m/%d/%Y. ποΈ-firstdayβ sets the first day of the week. eithersundayormonday. it defaults tomonday. (monday girlies, rise.) βοΈ-fontβ picks the font used in the widget. it defaults toHelvetica 9. π-highlightcolorβ picks the background color for the day that has been selected. default:#FFCC00. so golden, so main character. β¨-languageβ specifies the language of the calendar contents. you give it language abbreviations, for example:enβ english,deβ german ... it defaults toen.
supported languages: de en es fr gr he it ja sv pl pt zh fi tr nl ru crk crx-nak crx-lhe π
-shadecolorβ picks the color of the parts that have a shaded background. default:#888888. π©Ά-showpastβ says whether the past shall be shown. it's a boolean value and it defaults to1. (yes, the past stays visible unless you say otherwise, bestie.) β³-textvariableβ specifies the name of a variable whose value is linked to the entry widget's contents. whenever the variable changes value, the widget's contents get updated, and vice versa. it's a two-way situationship. π
π§ WIDGET COMMAND π§
pathname get ?what?
returns a part of the selected date, or all. the argument what selects which part. valid values for what are: day, month, year and all. all is the default and returns the complete date in the format given with -dateformat. π
π DEFAULT BINDINGS π
when the calendar widget gets created, these bindings get installed. when you press a key, the command is invoked and the textvariable is updated. updated. (yes, it says it twice, and honestly? mood. π)
- Home β move to the current date
- Up β move to the week before the current date
- Down β move to the week after the current date
- Left β move to the day before the current date
- Right β move to the day after the current date
- Control-Left β move to the month before the current date
- Control-Right β move to the month after the current date
- Control-Up β move to the year before the current date
- Control-Down β move to the year after the current date
lowkey the Control ones are the power moves. periodt. β¨οΈπ₯
π EXAMPLE π
package require widget::calendar ; # or widget::all
set t [widget::calendar .t]
pack $t -fill x -expand 1
three lines. she ate. π
π BUGS, IDEAS, FEEDBACK π
this document, and the package it describes, will undoubtedly contain bugs and other problems. (their words, not mine, but also... yeah. π)
pls report such in the category widget::calendar of the Tklib Trackers at [http://core.tcl.tk/tklib/reportlist].
also pls report any ideas for enhancements you may have for either the package and/or the documentation. they want the feedback, fr fr. π«Ά
π KEYWORDS π
calendar, date, megawidget, snit, widget
β CATEGORY β
Widget
and that's the whole page, bestie!! this beauty ships with tklib, version 1.0.2, and the page itself is dated widget_calendar(3tk) β so yeah, go build a calendar, you're gonna slay. no cap. ππ¦β¨π
π¦ 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