0

I want to change the background for a particular cell in this calendar

cal = Calendar(root,selectmode="day",year=2020,month=7,day=10)

in Tkinter. but I do not know how to do that please help me.

Khaled Ayed
  • 1,121
  • 3
  • 12
  • 29

1 Answers1

1

You can attach a tag to the particular day using calevent_create() and then use tag_config() to change the background color using the tag:

Below is an example:

import datetime

...

day = datetime.date(2020, 7, 20)
cal.calevent_create(day, "", tags="hi")
cal.tag_config("hi", background="red")
acw1668
  • 40,144
  • 5
  • 22
  • 34