diff --git a/README.rst b/README.rst index 3704cbf..8e34a05 100644 --- a/README.rst +++ b/README.rst @@ -115,6 +115,9 @@ Documentation Changelog --------- +- tkfilebrowser 2.2.2 + * Fix ValueError in after_cancel with Python 3.6.5 + - tkfilebrowser 2.2.1 * Fix __main__.py for python 2 diff --git a/changelog b/changelog index eea6a50..d238f3a 100644 --- a/changelog +++ b/changelog @@ -5,6 +5,10 @@ Copyright 2017 Juliette Monsel Changelog --------- + +- tkfilebrowser 2.2.2 + * Fix ValueError in after_cancel with Python 3.6.5 + - tkfilebrowser 2.2.1 * Fix __main__.py for python 2 diff --git a/setup.py b/setup.py index bf1fedb..88bb0db 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ long_description = f.read() setup(name='tkfilebrowser', - version='2.2.1', + version='2.2.2', description='File browser for Tkinter, alternative to tkinter.filedialog in linux with GTK bookmarks support.', long_description=long_description, url='https://github.com/j4321/tkFileBrowser', diff --git a/tkfilebrowser/tooltip.py b/tkfilebrowser/tooltip.py index f7d50e9..add41bf 100644 --- a/tkfilebrowser/tooltip.py +++ b/tkfilebrowser/tooltip.py @@ -101,7 +101,14 @@ def __init__(self, tree, delay=1500, **kwargs): self.current_item = None self.tree.bind('', self._on_motion) - self.tree.bind('', lambda e: self.tree.after_cancel(self._timer_id)) + self.tree.bind('', self._on_leave) + + def _on_leave(self, event): + try: + self.tree.after_cancel(self._timer_id) + except ValueError: + # nothing to cancel + pass def add_tooltip(self, item, text): """Add a tooltip with given text to the item.""" @@ -116,7 +123,11 @@ def _on_motion(self, event): self.tooltip.withdraw() self.current_item = None else: - self.tree.after_cancel(self._timer_id) + try: + self.tree.after_cancel(self._timer_id) + except ValueError: + # nothing to cancel + pass self._timer_id = self.tree.after(self.delay, self.display_tooltip) def display_tooltip(self):