Python Forum
[Tkinter] (CLOSED) CTkScrollableDropdown error: bad window path name ".!ctkscrollabledropdown"
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] (CLOSED) CTkScrollableDropdown error: bad window path name ".!ctkscrollabledropdown"
#1
(POST CLOSED)

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 it with clear_screen_widgets(). And 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 50, in <lambda> self.attach.winfo_toplevel().bind('<Configure>', 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"
Here is my ctk combobox with subsequent ctksd class:
import customtkinter as ctk
import CTkScrollableDropdown as ctksd

root = ctk.CTk()

combobox_client_info_1 = ctk.CTkComboBox(master=root, values=client_name_list)
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=client_name_list, justify="left", button_color="transparent", autocomplete=True)

root.mainloop()
I've seen this type of error when the parent/master widget can't be found, but I'm not sure if that's applicable here or how to resolve it. Does anyone have any ideas?
Reply
#2
There is an error in your posted code. You need to call CTk() before making your combo box. First off, you need to do this to assign a value to root before you use root here:
combobox_client_info_1 = ctk.CTkComboBox(master=root, values=client_name_list)
Perhaps more importantly, you need to call CTk() before creating any widgets because CTk() not only creates your first top level window, it also initializes the toolkit so you can start making windows, labels, buttons and combo boxes.
Reply
#3
(Feb-29-2024, 10:41 PM)deanhystad Wrote: You need to call CTk() before making your comb box.

Sorry, I do use "root = ctk.CTk()" before creating the widgets. The widget creation is done by a function in my full script, which is why I had it outside. I'll edit that. So I don't think that's causing the error.
Reply
#4
You need to post your real code. I don't want to guess what's causing the error.
Reply
#5
(Feb-29-2024, 11:12 PM)deanhystad Wrote: You need to post your real code. I don't want to guess what's causing the error.

My mistake, I've started a new post with a minimum reproducible example. I figured that'd be cleaner than fixing it here.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Interaction between Matplotlib window, Python prompt and TKinter window NorbertMoussy 3 544 Mar-17-2024, 09:37 AM
Last Post: deanhystad
  [closed] "checked" variable (attribute?) origin? paul18fr 4 559 Mar-05-2024, 04:20 PM
Last Post: deanhystad
  [Tkinter] CTkScrollableDropdown error: bad window path name ".!ctkscrollabledropdown" CopperGenie 1 415 Mar-03-2024, 04:32 AM
Last Post: deanhystad
Exclamation [Tkinter] Error when closing the main window with destroy TomasSanchexx 1 797 Aug-06-2023, 01:54 AM
Last Post: deanhystad
  [Tkinter] bad window path name jdos 6 5,735 Jun-25-2020, 06:25 AM
Last Post: jdos
  [Tkinter] How to make message box error stay on top of window scratchmyhead 1 8,322 May-10-2020, 10:21 PM
Last Post: scratchmyhead
  tkinter.TclError: bad window path name kenwatts275 3 14,858 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
  [Tkinter] Extrakt a Variable from a closed tkinter window hWp 5 3,831 Aug-23-2019, 09:01 PM
Last Post: woooee
  [WxPython] how to reopen a closed tab of wx.aui.Notebook? royer14 2 3,294 Feb-18-2019, 12:31 AM
Last Post: royer14

Forum Jump:

User Panel Messages

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