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

"invalid command name" message when closing app with protocol #119

Closed
Dylgod opened this issue Aug 4, 2024 · 1 comment
Closed

"invalid command name" message when closing app with protocol #119

Dylgod opened this issue Aug 4, 2024 · 1 comment

Comments

@Dylgod
Copy link

Dylgod commented Aug 4, 2024

When running this code and closing the window via WM_DELETE_WINDOW:

import customtkinter as CTk
from async_tkinter_loop.mixins import AsyncCTk


class App(CTk.CTk, AsyncCTk):
    def __init__(self):
        super().__init__()
        self.geometry("200x200")
        self.protocol("WM_DELETE_WINDOW", lambda: self.destroy())

if __name__ == '__main__':
    app = App()
    app.async_mainloop()

I get back:

invalid command name "2123019874816update"
    while executing
"2123019874816update"
    ("after" script)

If I replace async_mainloop() with main_loop() it closes without a message. Async functions in my larger app work just fine but I am unable to terminate it without this message appearing. I have tried #2283 as well as destroying all widgets individually and then the app itself but no luck. I get slightly different messages depending on when the program exits. In my main app I have an async function wired to a button.

If I exit immediately on startup the message is:

invalid command name "2156938685440check_dpi_scaling"
    while executing
"2156938685440check_dpi_scaling"
    ("after" script)
invalid command name "2156936779136update"
    while executing
"2156936779136update"
    ("after" script)

Clicking the button and exiting after the async function fully executes gives me a different command name:

invalid command name "2085764248448<lambda>"
    while executing
"2085764248448<lambda>"
    ("after" script)
invalid command name "2085764248320update"
    while executing
"2085764248320update"
    ("after" script)
@insolor
Copy link
Owner

insolor commented Aug 4, 2024

Duplicate of #90

@insolor insolor marked this as a duplicate of #90 Aug 4, 2024
@insolor insolor closed this as completed Aug 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants