Python Forum
[Tkinter] CTkScrollableDropdown error: bad window path name ".!ctkscrollabledropdown"
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] CTkScrollableDropdown error: bad window path name ".!ctkscrollabledropdown"
#1
Hello! I'm using tkinter, customtkinter (ctk), and CTkScrollableDropdown (ctksd). This last library adds the ability to easily implement scrollable dropdown menus to various ctk elements. I followed ctksd's installation instructions, imported the library, and called the CTkScrollableDropdown class after my ctk element like in their example. However, I'm getting this error after I delete the widget. The error keeps spamming with every interaction with the GUI thereafter.

Error:
Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\walde\AppData\Local\Programs\Python\Python310\lib\tkinter\__init__.py", line 1921, in __call__ return self.func(*args) File "C:\Users\walde\Desktop\Benjamin\Engineering\Contracts\20240202_client management software\src\v1\CTkScrollableDropdown\ctk_scrollable_dropdown.py", line 51, in <lambda> self.attach.winfo_toplevel().bind("<ButtonPress>", lambda e: self._withdraw() if not self.disable else None, add="+") File "C:\Users\walde\Desktop\Benjamin\Engineering\Contracts\20240202_client management software\src\v1\CTkScrollableDropdown\ctk_scrollable_dropdown.py", line 140, in _withdraw if self.winfo_viewable() and self.hide: File "C:\Users\walde\AppData\Local\Programs\Python\Python310\lib\tkinter\__init__.py", line 1267, in winfo_viewable self.tk.call('winfo', 'viewable', self._w)) _tkinter.TclError: bad window path name ".!ctkscrollabledropdown"
MRE:
import tkinter as tk
import customtkinter as ctk
import CTkScrollableDropdown as ctksd

def clear_screen_widgets(): # deletes all present widgets
    widgets = root.winfo_children() # Get a list of all the widgets in root
    for widget in widgets:
        widget.destroy()

def goto_screen_client_info_2(values):
    clear_screen_widgets()

root = ctk.CTk()

combobox_client_info_1 = ctk.CTkComboBox(master=root, values='foo')
combobox_client_info_1.place(relx=0.5, rely=0.33, relwidth=.4, anchor=tk.CENTER)
combobox_client_info_1.bind("<Return>", goto_screen_client_info_2) # run command when enter key is pressed
ctksd.CTkScrollableDropdown(combobox_client_info_1, values='foo', justify="left", button_color="transparent", autocomplete=True)

root.mainloop()
I suspect this might have to do with the fact that no parent is passed to CTkScrollableDropdown. Any ideas? Is there a safer method for deleting a widget that doesn't lead to this error?
Reply
#2
You should post your issue with the package on github.

It appears to work ok as long as you don't try to delete the dropdown window. There is no problem with deleting the combobox. Why are you deleting widgets anyway?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Interaction between Matplotlib window, Python prompt and TKinter window NorbertMoussy 3 541 Mar-17-2024, 09:37 AM
Last Post: deanhystad
  [Tkinter] (CLOSED) CTkScrollableDropdown error: bad window path name ".!ctkscrollabledropdown" CopperGenie 4 629 Mar-03-2024, 03:21 AM
Last Post: CopperGenie
Exclamation [Tkinter] Error when closing the main window with destroy TomasSanchexx 1 795 Aug-06-2023, 01:54 AM
Last Post: deanhystad
  [Tkinter] bad window path name jdos 6 5,733 Jun-25-2020, 06:25 AM
Last Post: jdos
  [Tkinter] How to make message box error stay on top of window scratchmyhead 1 8,320 May-10-2020, 10:21 PM
Last Post: scratchmyhead
  tkinter.TclError: bad window path name kenwatts275 3 14,857 Apr-26-2020, 08:16 PM
Last Post: kenwatts275
  tkinter window and turtle window error 1885 3 6,752 Nov-02-2019, 12:18 PM
Last Post: 1885
  Qt and QtPy Edit window & argument 1 has unexpected type 'Ui_MainWindow' Error Athul 6 21,231 Aug-20-2018, 02:09 PM
Last Post: Axel_Erfurt
  update a variable in parent window after closing its toplevel window gray 5 9,123 Mar-20-2017, 10:35 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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