j4321 / tkcalendar

Calendar widget for Tkinter
https://pypi.python.org/pypi/tkcalendar
GNU General Public License v3.0
98 stars 33 forks source link

Error when creating DateEntry widget with python 3.6.5 #13

Closed jasperlendla closed 6 years ago

jasperlendla commented 6 years ago

Hi,

since the update to Python 3.6.5 I get the following error message when the DateEntry widget is/should be created:

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python3.6/tkinter/__init__.py", line 1702, in __call__
    return self.func(*args)
  File "ghv.py", line 434, in new_booking
    self.begin_date = DateEntry(self.new_frame, locale = "de_DE", background='darkblue', foreground='white', borderwidth=2)
  File "/usr/lib/python3.6/site-packages/tkcalendar.py", line 785, in __init__
    self._setup_style()
  File "/usr/lib/python3.6/site-packages/tkcalendar.py", line 838, in _setup_style
    self.after_cancel(self._determine_bbox_after_id)
  File "/usr/lib/python3.6/tkinter/__init__.py", line 769, in after_cancel
    raise ValueError('id must be a valid identifier returned from '
ValueError: id must be a valid identifier returned from after or after_idle

If I try to close any open window of the application (window is not closed but all widgets disappear):

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python3.6/tkinter/__init__.py", line 1702, in __call__
    return self.func(*args)
  File "/usr/lib/python3.6/tkinter/__init__.py", line 2301, in destroy
    for c in list(self.children.values()): c.destroy()
  File "/usr/lib/python3.6/tkinter/__init__.py", line 2301, in destroy
    for c in list(self.children.values()): c.destroy()
  File "/usr/lib/python3.6/site-packages/tkcalendar.py", line 947, in destroy
    self.after_cancel(self._determine_bbox_after_id)
  File "/usr/lib/python3.6/tkinter/__init__.py", line 769, in after_cancel
    raise ValueError('id must be a valid identifier returned from '
ValueError: id must be a valid identifier returned from after or after_idle

I can reproduce this behaviour with the example code given on this website (the Calendar widget still works). As I am not familiar with the machanics of tcl/tk/tkinter I have no clue what is going on.

tcl 8.6.8 tk 8.6.8 Python 3.6.5 tkcalendar 1.2.0 (installed with pip 10)

j4321 commented 6 years ago

Thanks for reporting this bug. It comes from the change made to the after_cancel method in tkinter in Python 3.6.5:

bpo-32857: In tkinter, after_cancel(None) now raises a ValueError instead of canceling the first scheduled function. Patch by Cheryl Sabella.

I will fix my code as soon as possible.

jasperlendla commented 6 years ago

Great, thank you for the fast fix.

mottymu commented 6 years ago

I still have this problem with Python 3.6.5 tkcalendar 1.2.1

what should I have done?

j4321 commented 5 years ago

@mottymu Can you post the full error message you get so that I can see the line numbers and try to see if I forgot something in my fix?