2

I'm using tkinter in python for mac.

Simply put, I want to override the "minimize" button's functionality.

I'm already overriding the "X" button functionality in this fashion:

root = Tk()
root.protocol('WM_DELETE_WINDOW', doClose)

What I tried:

I looked into the WM states and there is no WM_ICONIFY_WINDOW or WM_MINIMIZE_WINDOW. I also tried working with WM_SAVE_YOURSELF but couldn't catch any interrupt.

what's the best known way of making tkinter do what I want when people hit "minimze" rather than the default settings?

Thanks!

NorthCat
  • 9,643
  • 16
  • 47
  • 50
ygoncho
  • 367
  • 1
  • 2
  • 12

1 Answers1

2

There is no standard WM_PROTOCOL message for minimization. It seems, the best solution - catching <Unmap> events:

from Tkinter import *

root = Tk()

def callback(event):
    print event


frame = Frame(root, width=100, height=100)
frame.bind("<Unmap>", callback)
frame.pack()

root.mainloop()

Related links: 1, 2, 3

Community
  • 1
  • 1
NorthCat
  • 9,643
  • 16
  • 47
  • 50