@@ -513,21 +513,29 @@ class Calendar(ttk.Frame):
513513
514514 :param parent: the parent frame
515515 :param callback: the callable to be executed on selection
516- :param kw: tkinter.frame keyword arguments
516+ :param year: the year as an integer, i.e. `2020`
517+ :param month: the month as an integer; not zero-indexed; i.e.
518+ "1" will translate to "January"
519+ :param day: the day as an integer; not zero-indexed
520+ :param kwargs: tkinter.frame keyword arguments
517521 """
518522 timedelta = datetime .timedelta
519523 datetime = datetime .datetime
520524
521- def __init__ (self , parent , callback : callable = None , ** kwargs ):
525+ def __init__ (self , parent , callback : callable = None ,
526+ year : int = None , month : int = None , day : int = None ,
527+ ** kwargs ):
522528 # remove custom options from kw before initializing ttk.Frame
523529 fwday = calendar .SUNDAY
524- year = kwargs .pop ('year' , self .datetime .now ().year )
525- month = kwargs .pop ('month' , self .datetime .now ().month )
530+ now = self .datetime .now ()
531+ year = year if year else now .year
532+ month = month if month else now .month
533+ day = day if day else now .day
526534 locale = kwargs .pop ('locale' , None )
527535 sel_bg = kwargs .pop ('selectbackground' , '#ecffc4' )
528536 sel_fg = kwargs .pop ('selectforeground' , '#05640e' )
529537
530- self ._date = self .datetime (year , month , 1 )
538+ self ._date = self .datetime (year , month , day )
531539 self ._selection = None # no date selected
532540 self .callback = callback
533541
0 commit comments