Author image Anthony Fletcher
and 1 contributors


Tk::Month - Calendar widget which shows one month at a time.


  use Tk;
  use Tk::Month;

  $m = $parent->Month(
                -month          => 'July',
                -year           => '1997',
                -title          => '%b %y',
                -command        => \&press,
                -printformat=> '%d',
                -navigation     => [0|1],
                -includeall     => [0|1],
                -showall        => [0|1],
                -first          => [0|1|2|3|4|5|6],

                -month          => 'July',
                -year           => '1997',
                -command        => \&press,
                -printformat=> '%d %B %Y %A',
                -navigation     => [0|1],
                -includeall     => [0|1],
                -showall        => [0|1],
                -first          => [0|1|2|3|4|5|6],

                -label          => 'Label',
                -command        => \&callback,


Tk::Month is a general purpose calendar widget which shows one month at a time and allows user defined button actions.



Adds a separator to the title menu.


Adds an entry to the title menu. This can be used to add extra functionality, such as closing the calendar widget or printing a month.


-month => 'month'

Sets the required month. The default is the current month.

-year => 'year'

Sets the required year. The default is the current year.

-title => 'strftime format'

Sets the format for the widget title. The default is %B %Y.

-command => \&press

Set the command to execute when a button is pressed. This function must accept a string (the title of the Month widget) and an array of arrays of dates. Each date is of the format specified by the -printformat option. The default is to print out the list on standard output.

-printformat => "strftime format"

Set the default format for dates when they are passed in an array of arrays to the -command function. The default is %d %B %Y.

-dayformat => "strftime format"

Set the default format for the days within the widget. The default is %d, i.e. the date of each day.

-showall => [0|1]

Causes the dates on buttons not actually in the month to be dsiplay. The default is to not show these dates.

-includeall => [0|1]

Causes the side buttons to include all the non-month dates. The defaults is to include all the dates.

-first => [0|1|2|3|4|5|6]

Sets the first day of the week. The default is 0 (i.e. Sunday).

-navigation => [0|1],

Sets whether the navigation buttons and menu are included. The default is to show the naviagation aids.

-side => [0|1],

Sets whether the side buttons are included. The default is to show the side button aids.


See Tk for Perl/Tk documentation.

See Tk::MiniCalendar for another Perl/Tk calendar widget implementation.


Anthony R Fletcher, <a r i f 'a-t' c p a n . o r g>


Copyright (C) 1998-2014 by Anthony R Fletcher. All rights reserved. Please retain my name on any bits taken from this code. This code is supplied as-is - use at your own risk.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.16.3 or, at your option, any later version of Perl 5 you may have available.