from tkinter import *
from tkcalendar import *
def get_date():
calendar.configure(today.get_date())
win = Tk()
win.title('Calendar Picker')
labeltext = StringVar()
label = Label(win,textvariable=labeltext)
label.pack(pady=10)
btn = Button(win,text='Pick a date',command=get_date)
btn.pack(pady=10)
today = Calendar(win,selectmode='day',year=2020,month=8,day=6)
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
from tkcalendar import Calendar
File "C:\Python38\lib\site-packages\tkcalendar\__init__.py", line 26, in <module>
from tkcalendar.dateentry import DateEntry
File "C:\Python38\lib\site-packages\tkcalendar\dateentry.py", line 35, in <module>
from tkcalendar.calendar_ import Calendar
File "C:\Python38\lib\site-packages\tkcalendar\calendar_.py", line 27, in <module>
import calendar
File "E:/Python/Python Projects Fun\calendar.py", line 18, in <module>
today = Calendar(win,selectmode='day',year=2020,month=8,day=6)
NameError: name 'Calendar' is not defined
I already pip installed tkcalendar however if I use the Calendar widget it showed the NameError. May I ask what's the requirement if I use Calendar for tkcalendar module? Is there something that I not yet installed? Anyone know how to solve the above problem? Because I checked the module tkcalendar includes Calendar widget. After I recognize the name crashes this problem, after I understand the mistake and change it then next time I will know how to deal with it.