Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/314.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Python Tkinter更改日历中单元格的背景?_Python_Windows_Tkinter_Calendar_Tkcalendar - Fatal编程技术网

使用Python Tkinter更改日历中单元格的背景?

使用Python Tkinter更改日历中单元格的背景?,python,windows,tkinter,calendar,tkcalendar,Python,Windows,Tkinter,Calendar,Tkcalendar,我想更改此日历中特定单元格的背景 cal = Calendar(root,selectmode="day",year=2020,month=7,day=10) 在特金特。 但我不知道该怎么做 请帮助我。您可以使用calevent\u create()将标签附加到特定日期,然后使用tag\u config()使用标签更改背景颜色: 以下是一个例子: 导入日期时间 ... 日期=日期时间。日期(2020年7月20日) calevent_创建(日期,“,标记=“hi”) cal.

我想更改此日历中特定单元格的背景

cal = Calendar(root,selectmode="day",year=2020,month=7,day=10)
在特金特。 但我不知道该怎么做
请帮助我。

您可以使用
calevent\u create()
将标签附加到特定日期,然后使用
tag\u config()
使用标签更改背景颜色:

以下是一个例子:

导入日期时间
...
日期=日期时间。日期(2020年7月20日)
calevent_创建(日期,“,标记=“hi”)
cal.tag_配置(“hi”,background=“red”)

这对我有用,非常感谢