Tk Source Code

View Ticket
Login
Ticket UUID: 8f92d112b0e47962da284cbbb866cf6741ba07c4
Title: Aqua: custom exit proc is not called when ::tk::mac::Quit is not defined
Type: Bug Version: 8.6.11
Submitter: chrstphrchvz Created on: 2023-12-22 18:16:29
Subsystem: 01. Bindings Assigned To: nobody
Priority: 5 Medium Severity: Important
Status: Open Last Modified: 2023-12-22 20:28:48
Resolution: None Closed By: nobody
    Closed on:
Description:

According to ::tk::mac documentation, if the system asks Tk to quit but the ::tk::mac::Quit proc is not defined, then the exit proc is called instead. This is no longer the case as of [a055a4fa5c68].

Prompted by how Python IDLE must now define ::tk::mac::Quit instead of a custom exit proc to avoid losing unsaved user data: https://github.com/python/cpython/issues/112898

User Comments: kevin_walzer added on 2023-12-22 20:28:48:
The command is behaving as designed: Tk (under the tkinter hood) is calling "exit" because ::tk::Mac::Quit is not defined. The custom IDLE "exit" command is being ignored because quit events are managed by Tk, not Python. What they need to do (and I thought they did this) is map their custom exit command to ::tk::Mac::Quit via a call to tk.createcommand.