Akascape / CTkListbox

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

<Question> Need for .after #58

Closed BhagyaJyoti22006 closed 2 months ago

BhagyaJyoti22006 commented 3 months ago

This is not an issue. Just a question I want help with. What is the need of using functions inside .after in line 110,115,119? What if i call these functions instantaneously.

I have created a general code for updating various listboxes in my frame. There are various bindings each triggering this general code to update the listboxes. However, in few of these functions, I am calling the general code+ another code just to update a given listbox. This triggers an error signifying that the listbox has not yet updated through the general code.

To fix this, i removed .after and called each command at the same frame. The script began working fine. However, I want to make sure that this does not have any deeper implications.

Thank You

Akascape commented 2 months ago

@BhagyaJyoti22006 It is to avoid quick visual change, like the hover color get displayed immediately after selecting the button which looks a little odd, so I first disable the hover, then enable it again after a few milliseconds.