How to listen the Tkinter application "About" button action on MAC How to listen the Tkinter application "About" button action on MAC tkinter tkinter

How to listen the Tkinter application "About" button action on MAC


You can't explicitly listen for activation of the default "About" menu. You can, however, create your own "About" menu.

There are two important steps. First, the internal name of the menu needs to be "about", and this menu needs to be added to the menubar before you add the menubar to the root window.

If you follow those two rules, any menu items you create will be placed before the default menu items. Here's a simple example:

import tkinter as tkroot = tk.Tk()def show_about():    top = tk.Toplevel()    label = tk.Label(top, text="This is my custom 'about' window")    button = tk.Button(top, text="Ok", command=top.destroy)    button.pack(side="bottom", pady=20)    label.pack(padx=20, pady=20)menubar = tk.Menu(root)apple_menu = tk.Menu(menubar, name="apple")menubar.add_cascade(menu=apple_menu)apple_menu.add_command(label="About mediavalet", command=show_about)root.configure(menu=menubar)root.mainloop()

screenshot of menu

A good reference for platform-specific menus is the Menu tutorial on tkdocs.com