Akascape / CTkListbox

A simple listbox for customtkinter (extenstion/add-on)
MIT License
132 stars 14 forks source link

Issue between CTkListbox super().bind_all and tk bbox call #12

Closed tsouzadaSSA closed 10 months ago

tsouzadaSSA commented 10 months ago

Hej!!

I have updated the CTkListbox and I am getting this error:

Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\tsouzada\AppData\Local\Programs\Python\Python39\lib\tkinter__init.py", line 1892, in call return self.func(*args) File "C:\Users\tsouzada\AppData\Local\Programs\Python\Python39\lib\site-packages\CTkListbox\ctk_listbox.py", line 115, in super().bind_all(key, lambda e: func(self.get()), add="+") File "C:\Users\tsouzada\AppData\Local\Programs\Python\Python39\lib\site-packages\customtkinter\windows\widgets\ctk_scrollable_frame.py", line 75, in self.bind("", lambda e: self._parent_canvas.configure(scrollregion=self._parent_canvas.bbox("all"))) File "C:\Users\tsouzada\AppData\Local\Programs\Python\Python39\lib\tkinter\init__.py", line 2731, in bbox self.tk.call((self._w, 'bbox') + args)) or None _tkinter.TclError: invalid command name ".!ctktabview.!ctkframe.!tab_environment.!ctkframe.!sidebar_environment.!ctkframe.!ctkframe.!canvas"

And I saw there was an update kind of related to that (https://github.com/Akascape/CTkListbox/commit/991da89d5a4fde8dde5c3db22c398fe241f76e40) Have you seen this kind of issue or do you have an idea what it could be about? This error happens when closing the CTk window

CTkListbox 0.7 customtkinter 5.2.0

Akascape commented 10 months ago

@tsouzadaSSA Not experiencing this issue. Maybe related to your environment. Is it showing the error with the basic example?

tsouzadaSSA commented 10 months ago

No, it is not. Thank you for your attention! I will continue debugging to understand were I messed it up

tsouzadaSSA commented 10 months ago

Hey, @Akascape

I managed to get the way to reproduce and it is quite specific. The issue can be reproduced if you have a window with a CTkListbox and a CTkTabview with another CTkTabview inside one of the non-selected tabs. Then the issue happens if you close the window without selecting the CTkTabview which has the CTkTabview.

So, given the script: image A CTkListbox beside a CTkTabview with 3 tabs: "A", "B" and "C". The tab "B" has another CTkTabview with 1 tab "B1".

To have the issue being reproduced you just need to run the script, then close the window (without clicking in the tab "B"). The result is: image

But if you run the script and click in the tab "B", there is no issue.

Have you seen this before?

The script if you want to try it: import customtkinter from CTkListbox import *

class APP(customtkinter.CTk): def init(self, test_mode=False): super().init()

    self.listbox = CTkListbox(self)
    self.listbox.pack(fill="both", expand=True, side="left")

    t1 = customtkinter.CTkTabview(self)
    t1.pack( expand=1, fill="both" )

    t1.add("A")
    t1.add("B")
    t1.add("C")

    B = customtkinter.CTkTabview(t1.tab("B"))
    B.pack( expand=1, fill="both" )
    B.add("B1")

    self.mainloop()

def main(): APP()

if name == "main": main()

BAndresen commented 10 months ago

Hello!

I'm jumping in here with the same issue if you don't mind. I get the same error that repeats a few times when I close my project. I'm running the same version on windows10. I don't get the error when running the example.py

I removed my CTKlistbox in my tabview but didn't work...

I switched back to a tkinter listbox for now but have my project up if you're interested in trying to reproduce the error. Just switch back to CtkListbox on line 52 in views/home_view.py and line 29 and 34 in controller.py

https://github.com/BAndresen/TOJA.git

I'll keep playing around, let me know if you find a fix! this widget is much better looking

codedreamin commented 10 months ago

This actually happens for me as well, in my case, I have a few listbox's inside of a tabview, if I don't click on all of the listbox's before closing the window I get this same error message.

Akascape commented 10 months ago

@BAndresen @codedreamin @tsouzadaSSA Guys, I have tried to fix this issue, please update to the latest version and let me know...

pip install CTkListbox --upgrade
tsouzadaSSA commented 10 months ago

@Akascape you rock! Fixed here!

BAndresen commented 10 months ago

@Akascape works for me, thxs so much!

codedreamin commented 10 months ago

@Akascape

I'm still getting this error for bad window path name ".!ctktitlemenu", but I no longer get any other errors, so it looks like it is mostly fixed.

Akascape commented 10 months ago

@codedreamin That error is causing due to ctktitlemenu. But the issue is similar.