I see the following on Aqua Tk 8.4.9 (MacOS X 10.3.7) but not on a
unix/X11 build on the same MacOS X. So it may be specific to Aqua
Tk.
If I create a dialog box that includes a menu then:
- post the menu
- select a menu item
- button presses are ignored for one or more buttons of the dialog box
Psueodcode to demonstrate this:
- create a toplevel (the dialog box); within this dialog box:
- create a variable doneVar
- create an option menu with a few entries and two buttons: OK and
Cancel
- set up commands so that if either button is pressed, it prints a
suitable message and sets doneVar
- grab
- wait for variable doneVar
- release the grab
- destroy the dialog box
If you selects a menu item from the option menu, then the dialog box
goes into this funny mode where:
- the first button (OK or Cancel) that you press will be ignored -- no
matter how many times you press it
- once you have pressed one button at least once, then if you press
the other button it will act normally
- if you bring up the menu but do NOT select an item from it then the
dialog box will act normally (both buttons work just fine)
If you eliminate the grab then the problem does not appear.
I have attached a python/tkinter script that demonstrates everything.
I have performed other tests and am pretty sure
I also tried a more complex dialog box with the OK and Cancel buttons
plus an Entry to which I had bound a contextual menu. I then bound
a print statement to <Enter> for all three of these widgets. After
selecting an item from the contextual menu, the bindings stopped
working for both buttons, though they continued to work for the
Entry widget. Clicking on the entry widget restored normal behavior.
Simple demo of grab bug in python/Tkinter