Python Forum
unexplained issue with tkcalender module.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
unexplained issue with tkcalender module.
#9
Using DateEntry as a variable name is a bad idea (line 100: DateEntry=cal). DateEntry is now an instance of the class tkcalendar.DateEntry instead of the class tkcalendar.DateEntry. You cannot make any more DateEntry objects ever again after this assignment. Maybe not a big problem in this case, but a potential source of confusion in the future and a big old flashing neon sign that says "I have no idea what I am doing!". Just use the variable "cal" when referencing the DateEntry object created in line 16.

Where do you think you are printing the selected date to the console. I cannot find where that would be happening.

Use the locale or date_pattern options to format how the date is displayed

https://tkcalendar.readthedocs.io/en/sta...r.html#doc < Notice readthedocs? Good advice. That's what I did.

If you want to print Yes, No instead of 1, 0, what's stopping you? Maybe you should read the docs. One solution is to configure the checkbox to use different values.

https://www.tutorialspoint.com/python/tk...button.htm

Another solution is to have the print statement print Yes or No instead of 1 or 0. There are lots of ways you can accomplish that. For example:
print(('No', 'Yes')[checkboxVar.get()])
Reply


Messages In This Thread
RE: unexplained issue with tkcalender module. - by deanhystad - Aug-12-2021, 11:00 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Empty default value for tkCalender Tyrel 2 946 Aug-08-2023, 04:57 PM
Last Post: Tyrel
Lightbulb [Tkinter] Tkinter Class Import Module Issue AaronCatolico1 6 3,228 Sep-06-2022, 03:37 PM
Last Post: AaronCatolico1

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020