我在 python 脚本中使用 ttkbootstrap。我尝试使用 ttkbootstrap 中的 DateEntry,但它不会像 tkcalendar 那样触发事件(至少我找不到任何东西),而且我喜欢 tkcalendar 侧面有一个周计数器。
所以我想使用 tkcalendar DateEntry 而不是 ttkbootstrap DateEntry。现在单独使用它可以完美地工作,但是当我一起使用 ttkbootstrap 和 tkcalendar 时我总是得到
AttributeError:“DateEntry”对象没有属性“_calendar”
这是我的代码,不起作用:
import ttkbootstrap as ttk
from tkcalendar import DateEntry
#setup the window
pwin = ttk.Window(themename="cyborg")
pwin.title('test')
#function to get the date
def seedate():
print(cal.get_date())
#this is he DateEntry widget
cal = DateEntry(pwin,bootstyle="info")
cal.place(x=10, y=80)
#button to get the selected date
btnpt = ttk.Button(pwin, text="Save Schedule", bootstyle="light-outline", command=seedate)
btnpt.place(x=10, y=140)
pwin.mainloop()
当我使用 ttkbootstrap DateEntry 时,它会立即起作用。
我尝试更新这两个模块,但没有成功。并切换到 ttkbootstram DateEntry,然后就可以了。