Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Destroying a scrolledframe while it is under the cursor gives bad window path #519

Open
sambler opened this issue Jan 5, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@sambler
Copy link

sambler commented Jan 5, 2024

Desktop (please complete the following information):

ttkbootstrap v1.10.1

Describe the bug

Destroying a scrolledframe when the cursor is over it causes a bad window path error. No error if the cursor is outside of the scrolledframe.

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/tkinter/__init__.py", line 1892, in __call__
    return self.func(*args)
  File "/home/shane/.local/lib/python3.9/site-packages/ttkbootstrap/scrolled.py", line 455, in _on_leave
    self.disable_scrolling()
  File "/home/shane/.local/lib/python3.9/site-packages/ttkbootstrap/scrolled.py", line 414, in disable_scrolling
    self._del_scroll_binding(self)
  File "/home/shane/.local/lib/python3.9/site-packages/ttkbootstrap/scrolled.py", line 394, in _del_scroll_binding
    children = parent.winfo_children()
  File "/usr/local/lib/python3.9/tkinter/__init__.py", line 1050, in winfo_children
    self.tk.call('winfo', 'children', self._w)):
_tkinter.TclError: bad window path name ".!frame3.!scrolledframe"

To Reproduce

Place the cursor over a scrolledframe when you destroy it.

A minimal example to run - press F5 to destroy and re-create the frame:

import tkinter as tk
from ttkbootstrap.scrolled import ScrolledFrame

class Main(tk.Tk):
    def __init__(self):
        super().__init__()
        self.list_items()
        self.bind('<F5>', self.list_items)

    def list_items(self, evnt=None):
        if hasattr(self, 'sf'):
            self.sf.destroy()
        self.sf = ScrolledFrame(self)
        self.sf.grid(row=1, column=0, sticky=tk.NSEW)

if __name__ == '__main__':
    mw = Main()
    mw.mainloop()

Expected behavior

No exception output when destroying the scrolledframe.

Screenshots

No response

Additional context

No response

@sambler sambler added the bug Something isn't working label Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant